diff --git a/.gitignore b/.gitignore index 8e754b5..f140dd0 100755 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ py-env/ passwd_gen deb_dock/home_skel/.vim/.netrwhist **/__pycache__/ +.idea/ diff --git a/install/apk.sh b/install/apk.sh index cd75af5..e11b9bf 100755 --- a/install/apk.sh +++ b/install/apk.sh @@ -12,6 +12,8 @@ apk add whois apk add nmap apk add man-db apk add vim +apk add iproute2 +apk add gitea apk add git-filter-repo diff --git a/install/apt.sh b/install/apt.sh index 2e83ad3..0cb5350 100755 --- a/install/apt.sh +++ b/install/apt.sh @@ -31,10 +31,6 @@ apt install -y pip apt install -y curl apt install -y tree apt install -y ffmpeg -apt install -y ffmpeg -apt install -y nft -apt install -y openvpn - #apt install -y vlc #apt install -y terminator #apt install -y gimp diff --git a/install/arch.sh b/install/arch.sh index edacbcf..bc88433 100755 --- a/install/arch.sh +++ b/install/arch.sh @@ -12,15 +12,25 @@ fi MACHINE_DIR=${1:-"svr"} bash tree_cpy.sh $MACHINE_DIR/usr +# append sources +bash config.sh source /home/.bashrc bash config.sh source /home/.bashrc -#bash python.sh -#source /home/.bashrc bash chmod.sh +# append sources bash pacman.sh source /home/.bashrc bash network.sh +#systemctl enable --now NetworkManager #enable dongle + +#pacman --noconfirm -Syu ulogd +#NETWORKDIR="$MACHINE_DIR/networking" +##TOR_LIST=$NETWORKDIR/tor_list.txt +##curl https://www.dan.me.uk/torlist/?full= > $TOR_LIST +#systemctl enable ulogd +#systemctl start ulogd +#bash $NETWORKDIR/iptables_script.sh -f $NETWORKDIR/ip_to_ban.txt -r diff --git a/install/chmod.sh b/install/chmod.sh index 354ea5c..0252c01 100755 --- a/install/chmod.sh +++ b/install/chmod.sh @@ -7,8 +7,9 @@ chown -R root $MACHINE_DIR chgrp -R $MACHINE $MACHINE_DIR chmod -R 771 $MACHINE_DIR/install chmod -R 771 $BIN_DIR -chmod -R 751 $SBIN_DIR +chmod -R 661 $MACHINE_DIR/.git find $MACHINE_DIR -type d -exec chmod 775 {} \; +chown root:root /etc/pam.d/* exit 0 diff --git a/install/config.sh b/install/config.sh index 21bc0ab..98faf62 100755 --- a/install/config.sh +++ b/install/config.sh @@ -21,3 +21,10 @@ cat $SUDO_HOME/$FILE > $SKEL/$FILE groupadd svr usermod -aG svr $SUDO_USER + +systemctl daemon-reexec +systemctl daemon-reload +systemctl enable tcpd +systemctl start tcpd + + diff --git a/install/openwrt.sh b/install/openwrt.sh old mode 100644 new mode 100755 diff --git a/install/pacman.sh b/install/pacman.sh index 2534b6e..889ec89 100755 --- a/install/pacman.sh +++ b/install/pacman.sh @@ -31,6 +31,7 @@ pacman --noconfirm -S makepkg pacman --noconfirm -S tree pacman --noconfirm -S vim pacman --noconfirm -S iwctl +pacman --noconfirm -S ncdu pacman --noconfirm -S pciutils pacman --noconfirm -S git-filter-repo pacman --noconfirm -S xorg-setxkbmap diff --git a/install/tree_cpy.sh b/install/tree_cpy.sh index 70093b2..37e3431 100755 --- a/install/tree_cpy.sh +++ b/install/tree_cpy.sh @@ -4,8 +4,9 @@ USR_DIR=${1:-"no_dir"} [[ $USR_DIR == "no_dir" ]] && \ echo "usage $0 usr_dir" && \ exit 1 - USR_DIR=$(realpath $USR_DIR) #uses ssymbolic link otherwise crossdevice troubles cp -s -p -r -f -t / $USR_DIR/. + +sudo chown root:svr /etc /var /run /dev /usr /sys / diff --git a/net/blacklist.txt b/net/blacklist.txt index 7b39724..b3b9ec2 100755 --- a/net/blacklist.txt +++ b/net/blacklist.txt @@ -1,71 +1,35 @@ 34.0.0.0/8 35.0.0.0/8 -#OVH -37.59.32.0/19 - -#Hetzner (arch install) -46.62.192.0/22 - -#Microsoft -#40.114.177.156 -> lilie.duckdns.org, holland -40.96.0.0/12 - -#Staples us (arch install) -50.74.152.24/29 - -# apparait apres avoir bloque 2 adresses google intrusives sud firefox -95.216.0.0/16 +#SKYCA-3#Owner:Fastly +151.101.0.0/16 #NETBLK Cox -#98.174.32.0/19 +98.174.32.0/19 #OVH -#37.59.32.0/19 +37.59.32.0/19 +#oman#mobile +134.0.192.0/20 + +# RIPE +# http addr +141.0.0.0/8 #Cloud flare chatgpt #104.16.0.0/12 -#oman#mobile -#134.0.192.0/20 - -#cloudflare eu (arch install) -# RIPE -# http addr -#141.0.0.0/8 - -#Google -142.250.0.0/15 - -#Fastly ip geolocalisation (arch install) -146.75.0.0/20 - -#SKYCA-3#Owner:Fastly -#pip atproto ? -#151.101.0.0/16 - -#OVH france -188.165.192.0/18 - -#Amsterdam, possiblement a Linz il y a quelques annees -193.0.0.0/20 - #Umea ftp archive (debian) #194.71.11.0/24 #Fastly Skyca -#199.232.0.0/16 +199.232.0.0/16 #LEVEL3-CIDR #209.244.0.0/14 #ionos #212.227.232.161 lors dúnse installation arch -#212.227.232.0/24 +212.227.232.0/24 1.0.0.1 - -#lancement firefox -fe80::b08c:e0ff:fe6d:542c/64 -ff02::0/48 -#ff02::1:ffbc:c929/120 diff --git a/net/whitelist.txt b/net/whitelist.txt index 6156c97..9b16827 100755 --- a/net/whitelist.txt +++ b/net/whitelist.txt @@ -2,6 +2,10 @@ 151.101.129.21 34.107.221.82 +#Dart +34.36.0.14 +62.169.136.227 + #sigmanet#codium 178.238.223.0/24 #gititea @@ -10,6 +14,9 @@ #microsoft (github) #20.0.0.0/11 +#pip +151.101.192.223 + #whois 199.212.0.0/24 @@ -19,78 +26,14 @@ #GitHub 185.199.111.0/24 -#ChatGpt -104.18.32.47 - -#ipinfo.io -34.117.59.81 - -#ifconfig.me -34.160.111.145 - -#gitea -34.217.253.146 +#dns +209.244.0.3 #protonmail 185.70.42.0/24 185.70.41.0/24 185.70.40.0/24 -##Paypal -#151.101.129.21 -# -##microsoft (github) -##20.0.0.0/11 -# -##Paypal -##34.107.221.82 -# -##ipinfo.io -#34.117.59.81 -# -##ifconfig.me -#34.160.111.145 -# -##gitea -#34.217.253.146 -# -##gitea docker -#35.91.213.186 -# -# -##docker -#34.107.221.82 -# -##dns -#66.28.0.61 -# -##infomaniac -#95.216.195.133 -# -##ChatGpt -#104.18.32.47 -# -##openwrt.org -#151.101.130.132 -#151.101.2.132 -# -# -##firefox extentions -#151.101.1.91 -# -##sigmanet#codium -#178.238.223.0/24 -# -##whois -#199.212.0.0/24 -# -##Umea ftp archive (debian) -#194.71.11.0/24 -# -##GitHub -#185.199.111.0/24 -# -##infomaniac shop -#142.250.178.136 -# -##dns -#209.244.0.3 + +#debian +146.75.0.0/20 +199.232.0.0/16 diff --git a/usr/bin/alpine-qemu-install b/usr/bin/alpine-qemu-install index 5170067..d64dff0 100755 --- a/usr/bin/alpine-qemu-install +++ b/usr/bin/alpine-qemu-install @@ -39,16 +39,20 @@ echo "iso = $ISO" qemu-system-x86_64 \ -m $RAM \ + -nic user \ -boot once=d \ -cdrom $ISO \ -drive file=$IMG \ -display none \ -device virtio-vga \ - -enable-kvm \ + -display default,show-cursor=on \ -net user,hostfwd=tcp::7777-:22 - -net nic #-virtfs local,id=share,path="$SHARE",security_model=none,mount_tag=hostshare - + -device virtio-vga \ + -enable-kvm \ + -display default,show-cursor=on \ + -display none \ + -virtfs local,id=share,path="$SHARE",security_model=none,mount_tag=hostshare ## --- Run QEMU with graphics + shared folder --- #qemu-system-x86_64 \ diff --git a/usr/bin/arch-arm-make-sd b/usr/bin/arch-arm-make-sd new file mode 100755 index 0000000..da724af --- /dev/null +++ b/usr/bin/arch-arm-make-sd @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +set -euo pipefail + +SDX="${1:-sdb}" + +BOOT="${SDX}1" +ROOT="${SDX}2" + +if [[ "$(id -u)" -ne 0 ]]; then + echo "Run as root." + echo "sdx as parameter" + exit 1 +fi + +echo "Target: /dev/${SDX}" +read -rp "Proceed? (y/N) " yn +[[ "${yn,,}" == "y" ]] || exit 0 + +# wipe partitions +fdisk /dev/"${SDX}" < "$DST/connections-$DATE.txt" + +# 2️⃣ Archiver les logs dans un tar.gz +ARCHIVE="$DST/logs-$DATE.tar.gz" +find "$SRC" -name "*.log" -print0 | tar --null -czf "$ARCHIVE" --remove-files -T - + +# 3️⃣ Vérifier la taille totale des archives et supprimer les plus anciennes si >1 Go +total_size=$(du -cb "$DST"/*.tar.gz 2>/dev/null | tail -1 | awk '{print $1}') + +while [ "$total_size" -ge $MAXSIZE ]; do + oldest=$(ls -1t "$DST"/*.tar.gz | tail -1) + [ -f "$oldest" ] && rm -f "$oldest" + total_size=$(du -cb "$DST"/*.tar.gz 2>/dev/null | tail -1 | awk '{print $1}') +done + diff --git a/usr/bin/aur b/usr/bin/aur index 09b1442..142dca4 100755 --- a/usr/bin/aur +++ b/usr/bin/aur @@ -1,6 +1,11 @@ #!/bin/bash aur () { - git clone https://aur.archlinux.org/$1.git + DIR=~/tmp + echo "note: ceci est un script maison" + mkdir $DIR + git clone https://aur.archlinux.org/$1.git $DIR/$1 + cd $DIR/$1 + makepkg -si } aur "$@" diff --git a/usr/bin/brc b/usr/bin/brc index fb20401..c5a399f 100755 --- a/usr/bin/brc +++ b/usr/bin/brc @@ -2,8 +2,7 @@ set -e -MACHINE_DIR=${1:$MACHINE_DIR} -MACHINE_DIR=${MACHINE_DIR:-"/svr"} +MACHINE_DIR="/svr" F_NAME=".bashrc"; cd "$MACHINE_DIR/usr/home"; commit_if_modified "$F_NAME" diff --git a/usr/bin/bsconn.py b/usr/bin/bsconn.py deleted file mode 100755 index c5db6d6..0000000 --- a/usr/bin/bsconn.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/bash - -if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then - echo "Usage: $0 arg1 [arg2] [arg3]" - exit 1 -fi - -# interactive session check -if [ -t 0 ]; then - echo -n "Delete existing output files? [y/N]: " - read ans - case "$ans" in - y|Y) rm -f *.school ;; - *) echo "Aborted"; exit 0 ;; - esac -fi - -# process input file -while IFS= read -r line; do - new_f="${line%.*}.school" - f > "$new_f" -done < "$FILE" - -exit 0 - diff --git a/usr/bin/bsdlfeeds.py b/usr/bin/bsdlfeeds.py index 3792abc..f749910 100755 --- a/usr/bin/bsdlfeeds.py +++ b/usr/bin/bsdlfeeds.py @@ -55,15 +55,11 @@ def get_feeds(client, profile, tmp_dir=TMP_DIR, save=False, cursor=None): def main(): parser = argparse.ArgumentParser(description="Download Bluesky profile posts to JSON") parser.add_argument("handle", help="Bluesky handle (ex: ni-bot.bsky.social)") - parser.add_argument("--folder", default=TMP_DIR) + parser.add_argument("-d", "--folder", default=TMP_DIR) args = parser.parse_args() client = connect() -<<<<<<< HEAD - profile = get_feeds(client, args.handle, args.folder, cursor=cursor) -======= profile = get_feeds(client, args.handle, args.folder) ->>>>>>> 01ee0aacb9e93bd6572ab9049f26878733f8bf85 diff --git a/usr/bin/clone b/usr/bin/clone index 09c1f9d..80fbd26 100755 --- a/usr/bin/clone +++ b/usr/bin/clone @@ -9,8 +9,10 @@ clone () PROJECT_NAME="$2"; git clone --recurse-submodules $URL/$PROFIL_NAME/$PROJECT_NAME.git; else + PROFIL_NAME=painpain PROJECT_NAME="$1"; git clone --recurse-submodules $URL/$PROFIL_NAME/$PROJECT_NAME.git; fi + git clone --recurse-submodules $URL/$PROFIL_NAME/$PROJECT_NAME.git; } clone "$@" diff --git a/usr/bin/expresso b/usr/bin/expresso index 237e056..07a997f 100755 --- a/usr/bin/expresso +++ b/usr/bin/expresso @@ -1,11 +1,11 @@ #!/bin/bash expresso () { - DIR="$HOME/perso/thm/interets/jeux/poker"; - HISTORY="expresso_history.md"; + DIR="$HOME/perso/jeux/holdem/"; + HISTORY="historique.md"; SCRIPT=expresso_stat.sh; TAIL=${1:-1000}; vim + $DIR/$HISTORY; - bash $DIR/$SCRIPT $DIR/$HISTORY $TAIL + bash $SCRIPT $DIR/$HISTORY $TAIL } expresso "$@" diff --git a/usr/bin/firefox-qemu-run b/usr/bin/firefox-qemu-run new file mode 100755 index 0000000..4db8ef8 --- /dev/null +++ b/usr/bin/firefox-qemu-run @@ -0,0 +1,36 @@ +#!/bin/bash +set -eux + +# from vm to make a shared folder +if [ $# -lt 1 ] ; then + echo """ + """ + echo "cheat sheet: mount -t 9p -o trans=virtio hostshare /mnt" + exit 1 +fi + +# --- Configurable defaults --- +IMG=${1:-disc_alpine.qcow2} +SSH=${2:-2222} +SHARE=${3:-$PWD/shared} +CPUS=${4:-2} +SIZE=${5:-16G} +RAM=${6:-2G} + +# --- Setup --- +mkdir -p "$SHARE" + +# --- Optional install script --- +# Drop any file named install.sh in ./share to execute it inside the VM later: +# e.g. `bash /mnt/share/install.sh` after mounting + + + +qemu-system-x86_64 \ + -m $RAM \ + -boot once=d \ + -drive file=$IMG \ + -enable-kvm \ + -display spice-app,show-cursor=on \ + -nic user,hostfwd=tcp::"${SSH}"-:22 + diff --git a/usr/bin/alpine-qemu-run b/usr/bin/gitea-qemu-run similarity index 70% rename from usr/bin/alpine-qemu-run rename to usr/bin/gitea-qemu-run index 8de57fd..3a64030 100755 --- a/usr/bin/alpine-qemu-run +++ b/usr/bin/gitea-qemu-run @@ -4,11 +4,13 @@ set -eux # from vm to make a shared folder if [ $# -lt 1 ] ; then echo """ - IMG=${1:-disc_alpine.qcow2} - SIZE=${2:-16G} - RAM=${3:-2G} - CPUS=${4:-2} - SHARE=${5:-$PWD/share} +IMG=${1:-disc_alpine.qcow2} +SSH=${2:2223} +SHARE=${3:-$PWD/share} +CPUS=${4:-2} +SIZE=${5:-16G} +RAM=${6:-2G} +GITEA=${7:-3000} """ echo "cheat sheet: mount -t 9p -o trans=virtio hostshare /mnt" exit 1 @@ -16,10 +18,12 @@ fi # --- Configurable defaults --- IMG=${1:-disc_alpine.qcow2} -SIZE=${2:-16G} -RAM=${3:-2G} +SSH=${2:-2223} +SHARE=${3:-$PWD/share} CPUS=${4:-2} -SHARE=${5:-$PWD/share} +SIZE=${5:-16G} +RAM=${6:-2G} +GITEA=${7:-3000} # --- Setup --- mkdir -p "$SHARE" @@ -37,6 +41,6 @@ qemu-system-x86_64 \ -device virtio-vga \ -enable-kvm \ -display default,show-cursor=on \ - -nic user,hostfwd=tcp::2222-:22 \ + -nic user,hostfwd=tcp::"${SSH}"-:22,hostfwd=tcp::"${GITEA}"-:3000 \ -virtfs local,id=share,path="$SHARE",security_model=none,mount_tag=hostshare diff --git a/usr/bin/history-del b/usr/bin/history-del new file mode 100755 index 0000000..c84deb2 --- /dev/null +++ b/usr/bin/history-del @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +NB_LINES=${1:=5} +for ((i=0;i [extra yt-dlp args...]" >&2 + exit 1 +fi + +# Change profile name if needed (e.g. default-release, yourprofile.default) +BROWSER="firefox" +PROFILE="default-release" # or leave empty to let yt-dlp auto-detect + +if [ -n "$PROFILE" ]; then + yt-dlp --cookies-from-browser "${BROWSER}:${PROFILE}" "$@" +else + yt-dlp --cookies-from-browser "$BROWSER" "$@" +fi + diff --git a/usr/etc/env b/usr/etc/env index 70eedf1..37e3924 100755 --- a/usr/etc/env +++ b/usr/etc/env @@ -13,6 +13,7 @@ LOG_CONN_DIR=/var/log/tcpd LOG_CONN=$LOG_CONN_DIR/lasts.log NET_STATUS=/tmp/status.txt SSH=177 +IAMUTOPIST=128.65.199.189 JOURNAL_DIR=$HOME/journal PERSO_DIR=$HOME/perso diff --git a/usr/etc/pam.d/login b/usr/etc/pam.d/login index f073226..3e2c27d 100755 --- a/usr/etc/pam.d/login +++ b/usr/etc/pam.d/login @@ -1,13 +1,8 @@ #%PAM-1.0 - auth requisite pam_nologin.so auth include system-local-login -auth optional pam_gnome_keyring.so account include system-local-login - session include system-local-login -session optional pam_gnome_keyring.so auto_start - password include system-local-login diff --git a/usr/etc/pam.d/system-local-login b/usr/etc/pam.d/system-local-login new file mode 100755 index 0000000..5fe484f --- /dev/null +++ b/usr/etc/pam.d/system-local-login @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth required pam_unix.so try_first_pass +account required pam_unix.so +password required pam_unix.so +session required pam_unix.so + diff --git a/usr/etc/resolv.conf b/usr/etc/resolv.conf index d09b2cf..e674b15 100755 --- a/usr/etc/resolv.conf +++ b/usr/etc/resolv.conf @@ -1,5 +1,3 @@ + nameserver 1.1.1.1 nameserver 0.0.0.0 -nameserver 8.26.56.26 -nameserver 208.67.222.222 -nameserver 209.244.0.3 diff --git a/usr/etc/systemd/resolved.conf b/usr/etc/systemd/resolved.conf old mode 100644 new mode 100755 index d7828f8..e69de29 --- a/usr/etc/systemd/resolved.conf +++ b/usr/etc/systemd/resolved.conf @@ -1,44 +0,0 @@ -# This file is part of systemd. -> systemctl enable --now systemd-resolved -# -# systemd is free software; you can redistribute it and/or modify it under the -# terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; either version 2.1 of the License, or (at your option) -# any later version. -# -# Entries in this file show the compile time defaults. Local configuration -# should be created by either modifying this file (or a copy of it placed in -# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in -# the /etc/systemd/resolved.conf.d/ directory. The latter is generally -# recommended. Defaults can be restored by simply deleting the main -# configuration file and all drop-ins located in /etc/. -# -# Use 'systemd-analyze cat-config systemd/resolved.conf' to display the full config. -# -# See resolved.conf(5) for details. - -[Resolve] -# Some examples of DNS servers which may be used for DNS= and FallbackDNS=: -DNS=1.1.1.1 2606:4700:4700::1111 2606:4700:4700::1001 -# Quad9: 9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net -FallbackDNS=185.253.5.0 2a0f:fc80:: 2a0f:fc81:: -# -# Using DNS= configures global DNS servers and does not suppress link-specific -# configuration. Parallel requests will be sent to per-link DNS servers -# configured automatically by systemd-networkd.service(8), NetworkManager(8), or -# similar management services, or configured manually via resolvectl(1). See -# resolved.conf(5) and systemd-resolved(8) for more details. -#DNS= -#FallbackDNS=9.9.9.9#dns.quad9.net 2620:fe::9#dns.quad9.net 1.1.1.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 8.8.8.8#dns.google 2001:4860:4860::8888#dns.google -#Domains= -DNSSEC=allow-downgrade -DNSOverTLS=yes -MulticastDNS=yes -LLMNR=yes -Cache=yes -CacheFromLocalhost=no -DNSStubListener=yes -#DNSStubListenerExtra= -ReadEtcHosts=yes -#ResolveUnicastSingleLabel=no -#StaleRetentionSec=0 -#RefuseRecordTypes= diff --git a/usr/etc/systemd/sleep.conf b/usr/etc/systemd/sleep.conf new file mode 100644 index 0000000..a63adbd --- /dev/null +++ b/usr/etc/systemd/sleep.conf @@ -0,0 +1,29 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Entries in this file show the compile time defaults. Local configuration +# should be created by either modifying this file (or a copy of it placed in +# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in +# the /etc/systemd/sleep.conf.d/ directory. The latter is generally +# recommended. Defaults can be restored by simply deleting the main +# configuration file and all drop-ins located in /etc/. +# +# Use 'systemd-analyze cat-config systemd/sleep.conf' to display the full config. +# +# See systemd-sleep.conf(5) for details. + +[Sleep] +#AllowSuspend=yes +#AllowHibernation=yes +#AllowSuspendThenHibernate=yes +#AllowHybridSleep=yes +SuspendState=freeze #mem standby freeze +HibernateMode=platform # shutdown +#MemorySleepMode= +#HibernateDelaySec= +#HibernateOnACPower=yes +#SuspendEstimationSec=60min diff --git a/usr/etc/systemd/system/tcpd.service b/usr/etc/systemd/system/tcpd.service index 53c711e..eb919b1 100755 --- a/usr/etc/systemd/system/tcpd.service +++ b/usr/etc/systemd/system/tcpd.service @@ -1,10 +1,11 @@ [Unit] -Description=watch connections -After=network-online.target +Description=TCP connections logger +After=network.target [Service] -ExecStart=/bin/bash /etc/systemd/system/tcpd.sh Type=simple +ExecStart=/usr/bin/tcpdump +Restart=always [Install] WantedBy=multi-user.target diff --git a/usr/home/.bash_aliases b/usr/home/.bash_aliases index 8af0a68..d5b9f81 100755 --- a/usr/home/.bash_aliases +++ b/usr/home/.bash_aliases @@ -24,9 +24,19 @@ alias val="valgrind --leak-check=full --show-leak-kinds=all" alias mvj='rsync -aH --remove-source-files' alias cpj='rsync -aH' alias git_light="git filter-repo --strip-blobs-bigger-than 10M" -alias src="source ~/.bashrc" alias s="sudo -E" +function src() { + source $HOME/.bashrc || true + d="$PWD"; while [ "$d" != "/" ]; do + for a in "$d/bin/activate" "$d/.env/bin/activate"; do + [ -f $a ] && echo "found at $a" && . "$a" && break 2 + done + d=$(dirname "$d") + done +} + + ##convert mp3 to wav #to_wav () { # OUTDIR_NAME="wav_files" diff --git a/usr/home/.bashrc b/usr/home/.bashrc index a78f5df..79d1e60 100755 --- a/usr/home/.bashrc +++ b/usr/home/.bashrc @@ -4,9 +4,9 @@ if [ -f /etc/env ]; then - set -a - . /etc/env - set +a + set -a + . /etc/env + set +a fi set -o vi @@ -104,7 +104,7 @@ RESET_COLOR="$NO_COLOR" export GIT_EDITOR=vim BRANCH="$(git rev-parse --abbrev-ref HEAD)" -PS1="\n${DATE_COLOR}\D{%y%m%d}${RESET_COLOR}-${TIME_COLOR}\t${RESET_COLOR}-${USER_COLOR}\u${RESET_COLOR}@${HOST_COLOR}\H${RESET_COLOR}-${DIR_COLOR}\w${RESET_COLOR}\n=> " +PS1="\n\n${DATE_COLOR}\D{%y%m%d}${RESET_COLOR}-${TIME_COLOR}\t${RESET_COLOR}-${USER_COLOR}\u${RESET_COLOR}@${HOST_COLOR}\H${RESET_COLOR}-${DIR_COLOR}\w${RESET_COLOR}\n=> " export HISTCONTROL=ignorespace @@ -122,21 +122,16 @@ export AWK_GREP_KEY="'{ } }'" -#ctags -R . - bind -f /home/.inputrc - if [ -f /home/.bash_aliases ]; then - . /home/.bash_aliases + . /home/.bash_aliases fi # permet les accents setxkbmap us -variant intl -source $PY_ENV/bin/activate #envsubst < ${MACHINE_PATH}/dotfiles/ssh/config.template > ~/.ssh/config #export PATH=~/.npm-global/bin:$PATH - diff --git a/usr/home/.vimrc b/usr/home/.vimrc index 4b06189..2a38fd3 100755 --- a/usr/home/.vimrc +++ b/usr/home/.vimrc @@ -87,8 +87,7 @@ autocmd BufNewFile *.c 0r ./.vim/templates/template.c set mouse=a -inoremap {{ {}O -inoremap {;{ ;}O +inoremap { {}O :nnoremap @q @@ -102,3 +101,5 @@ set tags=./tags;,tags; syntax on set tags=./tags;/ + +set smartindent