.git broken, restart

This commit is contained in:
dangerboot
2026-01-23 08:55:18 +01:00
commit d1be8ebdca
206 changed files with 8431 additions and 0 deletions
+643
View File
@@ -0,0 +1,643 @@
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias ll='ls -alFh'
alias la='ls -A'
alias l='ls -CF'
alias ccc="cc -Wall -Wextra -Werror $@"
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"
##convert mp3 to wav
#to_wav () {
# OUTDIR_NAME="wav_files"
# #mkdir $OUTDIR_NAME
# for file in "$@" ; do
# WAV_NAME=${file%.*}.wav
# echo $file
# echo
# ffmpeg -i $file -ar 16000 -ac 1 "$WAV_NAME"
# done
#}
#
##convert wav to mp3
#to_mp3 () {
# #OUTDIR_NAME="wav_files"
# #mkdir $OUTDIR_NAME
# for file in "$@" ; do
# MP3_NAME=${file%.*}.mp3
# echo $file
# echo
# ffmpeg -i $file -vn -b:a 192k "$MP3_NAME"
# done
#}
#
#cexec () {
# BASE=($@)
# NAME="${BASE%.*}"
# FLAGS=('-Wall' '-Wextra' '-Werror')
# cc ${FLAGS[@]} $BASE -o "$NAME" && ./"$NAME" && rm $NAME
#}
#
#cdebug () {
# BASE="$1"
# NAME="${BASE%.*}"
# FLAGS="-g3"
# cc $BASE $FLAGS -o "$NAME" && gdb "$NAME" && rm $NAME
#}
#
#brc () {
# SOURCE="$HOME/.bashrc"
# F_NAME=".bashrc"
# FILE="$(find -O3 $HOME -name $F_NAME 2>/dev/null | head -n 1)"
# F_PATH="$(dirname $FILE)"
# cd "$F_PATH"
# commit_if_modified "$F_NAME"
# cd -
# source $SOURCE
#}
#
#vrc () {
# SOURCE="$HOME/.vimrc"
# F_NAME=".bash_aliases"
# FILE="$(find -O3 $HOME -name $F_NAME 2>/dev/null | head -n 1)"
# F_PATH="$(dirname $FILE)"
# cd "$F_PATH"
# commit_if_modified "$F_NAME"
# cd -
# source $SOURCE
#}
#basha () {
# SOURCE="$HOME/.bashrc"
# F_NAME=".bash_aliases"
# FILE=$HOME/$F_NAME
# cd "$HOME/machine"
# commit_if_modified "$FILE"
# cd -
# source $SOURCE
#}
#
#machine_install () {
# FILE=~/machine/install.sh
# vim $FILE
# cd $FILE
# git add $FILE
# git commit -m "$FILE install mofified"
# git push
# cd -
#}
#
#arch_install () {
# FOLD=~/machine
# FILE=$FOLD/arch_install.sh
# vim $FILE
# cd $FOLD
# git add $FILE
# git commit -m "$FILE install mofified"
# git push
# cd -
#}
#
#netstat_tunlp () {
# netstat -tunlp
#}
#
#nmap_full () {
# sudo nmap --scanflags URGACKPSHRSTSYNFIN $@
#}
#
#nmap_sA () {
##ACK scan: the target would respond to the ACK with RST regardless of the state of the port
##help to guess firewall rules if the packet is droped
# nmap -sA --reason #or -v -vv -d -dd
#}
#
#nmap_version () {
# #-O = OS detection
# #-sV services versions
# #version intensity max
# #-sC use default script
# nmap -sV --version-intensity 9 -O -sC $@
#}
#
#nmap_ssh_brute () {
# nmap --script "ssh-brute" $1 #--script-args userdb=user_list.txt,passdb=passwd_list.txt
#}
#
#gitmain () {
# if [ -z "$1" ]; then
# git checkout main
# git reset --hard "$1"
# git push origin main --force
# fi
#}
#
#gitadd () {
# make fclean
# git add .
#}
#
#gitaddcommit () {
# gitadd
# if [ -n "$1" ]; then
# git commit -m "$1"
# else
# git commit
# fi
#}
#
#gitotal () {
# gitaddcommit $@
# git pull
# if [ -n "$?" ] ; then
# git push origin HEAD
# fi
#}
#
#gitlog () {
# git log --oneline --decorate --graph --all
#}
#
#aur () {
# git clone https://aur.archlinux.org/$1.git
#}
#
#history_full () {
# HIST_FILE=~/.history
# # => cat ~/.history | head -4
# # git diff
# # #1741473628
# # make && lldb ./push_swap
# # #1741474988
# while read LINE; do
# if [ -n "$(echo "$LINE" | grep '^#')" ]; then
# date -d "$(echo $LINE | sed 's/\#/@/g')"
# else
# echo "$LINE"
# fi
# done < $HIST_FILE
#}
#
#normi () {
# norminette -R CheckForbiddenSourceHeader -R CheckDefine $1
#}
#
#
#ulog_sort () {
# sudo grep -Eo "MAC.*DST=[^ ]*" /var/log/ulogd.syslogemu | sort | uniq -c | sort -n
#
#}
#
#header_awk () {
# grep -RE $CFUNCTION src | cut -d: -f2 | sed s/\$/';'/g
#}
#
#clone () {
# if [ $# -eq "3" ] ; then
# PROFIL_NAME="$1"
# PROJECT_NAME="$2"
# git clone https://github.com/$PROFIL_NAME/$PROJECT_NAME.git
# else
# PROJECT_NAME="$1"
# git clone git@github.com:nidionis/$PROJECT_NAME.git
# fi
#}
#
#iptables_update () {
# F_PATH="$(dirname $FILE)"
# F_PERSISTENT="/etc/iptables.rules"
# FILE="$(find /home -name 'iptables_script.sh' | head -1)"
# F_TMP=/etc/iptables.rules.backup
# sudo cp $F_PERSISTENT > $F_TMP
# vim + $FILE
# sudo ./$FILE -s -f ip_to_ban.txt -r
# sudo iptables-save > $HOME/tmp
# sudo mv $HOME/tmp $F_PERSISTENT
#}
#
#bashalias ()
#{
# vim ~/.bash_aliases
#}
#
#bashrc ()
#{
# vim ~/.bashrc
#}
#
#
#uniqq ()
#{
# for F in $@ ; do
# sort $F | uniq -c | sort -nr
# done
#}
#
#testee ()
#{
# if [ "$#" -gt 2 -o "$#" -eq 0 ]; then
# echo "Usage: $0 [path/to] <file>"
# echo "default file path is journal/not_sorted/$(date +%F)_${USER}_${$HOST}_${$PWD}.txt"
# return 1
# fi
#}
#
#journal-perso ()
#{
# refresh_time
# DIR_ORIGINAL=$PWD
# DIR="$HOME/perso"
# DATE_DIR="$YEAR/$MONTH/$DAY"
# if [ "$#" -eq 0 ]; then
# echo "Usage: $0 [ subfolder ] < file >"
# echo "default path is $DIR"
# echo "default file name is $F_NAME"
# return 1
# fi
# if [ "$#" -eq 1 ]; then
# LN_DIR="fouretout"
# F_NAME=$1
# fi
# if [ "$#" -eq 2 ]; then
# LN_DIR="$1"
# F_NAME=$2
# else
# return 1
# fi
# F_NAME+=".md"
# cd $DIR
# PATH_="${DATE_DIR}/${LN_DIR}"
# mkdir -p "$PATH_"
# FILE="${PATH_}/${F_NAME}"
# header_journal $FILE
# if commit_if_modified $FILE ; then
# mkdir -p "$DIR/$LN_DIR"
# ln -P "$FILE" "$DIR/$LN_DIR/"
# else
# rm $FILE
# rmdir -p "${PATH_}"
# fi
# cd $DIR_ORIGINAL
#}
#
#journal ()
#{
# refresh_time
# DIR_ORIGINAL=$PWD
# DIR="$HOME/journal"
# DATE_DIR="$YEAR/$MONTH/$DAY"
# if [ "$#" -eq 0 ]; then
# echo "Usage: $0 [ subfolder ] < file >"
# echo "default path is $DIR"
# echo "default file name is $F_NAME"
# return 1
# fi
# if [ "$#" -eq 1 ]; then
# LN_DIR="fouretout"
# F_NAME=$1
# fi
# if [ "$#" -eq 2 ]; then
# LN_DIR="$1"
# F_NAME=$2
# else
# return 1
# fi
# F_NAME+=".md"
# cd $DIR
# PATH_="${DATE_DIR}/${LN_DIR}"
# mkdir -p "$PATH_"
# FILE="${PATH_}/${F_NAME}"
# header_journal $FILE
# if commit_if_modified $FILE ; then
# mkdir -p "$DIR/$LN_DIR"
# ln -P "$FILE" "$DIR/$LN_DIR/"
# else
# rm $FILE
# rmdir -p "${PATH_}"
# fi
# cd $DIR_ORIGINAL
#}
#
#ps_parents ()
#{
# if [ "$#" -ne 1 ]; then
# echo "Usage: $0 <pid>"
# return 1
# fi
# pid=$1
# while [ "$pid" -ne 1 ]; do
# ps -p $pid -o pid=,ppid=,cmd=;
# pid=$(ps -p $pid -o ppid= --no-headers);
# done
#}
#
#kill_all ()
#{
# if [ -z "$1" ]; then
# echo "Usage: $0 <keyword>"
# exit 1
# fi
#
# KEYWORD="$1"
# ps aux | grep "$KEYWORD" | grep -v "grep" | awk '{print $2}' | xargs -r kill -9
#}
#
#gcl ()
#{
# git clone $1 $2
#}
#
#src ()
#{
# source $HOME/.bashrc
#}
#
## from https://wiki.alpinelinux.org/wiki/Installing_Alpine_in_a_virtual_machine
#alpine_launch ()
#{
# DIR="$HOME"/alpine
# FILE=$(find $DIR -iregex ".*alpine.*86_64.iso")
# #FILE="$DIR"/alpine-standard*iso
# qemu-system-x86_64 -m 512 -nic user,hostfwd=tcp::2222-:22 -boot d -cdrom $FILE -hda alpine.qcow2 -enable-kvm #-display gtk
#}
#
#compose ()
#{
# docker compose up --watch
#}
#
#cert_local ()
#{
# DIR=${1:-"certs"}
#
# mkdir -p $DIR
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
# -keyout $DIR/localhost.key \
# -out $DIR/localhost.crt \
# -subj "/CN=localhost"
#}
#
#virtual() {
# if [ -z "$1" ]; then
# echo "Usage: virtual <fichier.iso> [arguments supplémentaires pour QEMU]"
# return 1
# fi
# ISO="$1"
# shift
# if [ ! -f "$ISO" ]; then
# echo "Erreur : fichier '$ISO' introuvable."
# return 1
# fi
#
# qemu-system-x86_64 $ISO \
# -enable-kvm \
# -m 2048 \
# -cpu host \
# -cdrom "$ISO" \
# -boot d \
# -vga virtio \
# -nic user \
# "$@"
#}
#
#refresh_time () {
# export DATE=$(date +"%y%m%d")
# export TIME=$(date +"%T")
#}
#
#header_journal () {
# F_NAME=$1
# echo "$DATE" >> $F_NAME
# echo "$TIME" >> $F_NAME
# echo "$USER" >> $F_NAME
# echo "$HOST" >> $F_NAME
# echo >> $F_NAME
# echo "###############################################" >> $F_NAME
# echo >> $F_NAME
# echo "$F_NAME" >> $F_NAME
# echo >> $F_NAME
#}
#
#journalctl_prettyfy () {
# SIZE=${1:-"100"}
# UNIQ_MIN=${2:-"1"}
# BOOT=${3:-"0"}
# local TMP="/tmp/journalctl_prettyf.tmp"
# _FILE=${4:-"$TMP"}
#
# CMD="sudo journalctl -b ${BOOT} | tail -n $SIZE"
# CMD_SORTED="${CMD} | cut -d\: -f 4- | sort | uniq -c | sort -n"
# rm -f "$TMP"
# append_cmd "$CMD" "$TMP"
# append_cmd "$CMD_SORTED" "$TMP"
# grep -vE " +[0-${UNIQ_MIN}] " $TMP >> "$_FILE"
# if ! $# ; then cat $_FILE ; fi
# rm "$TMP"
#}
#
#append_cmd () {
# local CMD=$1
# local F_NAME=$2
# echo >> $F_NAME
# echo ${CMD} >> $F_NAME
# echo >> $F_NAME
#
# eval ${CMD} >> $F_NAME
# echo >> $F_NAME
# echo "###############################################" >> $F_NAME
# echo >> $F_NAME
#}
#
#commit_if_modified () {
# local F_NAME=$1
# local DEL=$2
# git pull
# vim + $F_NAME
# git add $F_NAME
# if ! git commit ; then
# echo -n "[no modifications]"
# if [ -n "$DEL" ] ; then
# rm $F_NAME
# echo -n " -> deleted"
# return 1
# fi
# fi
# git push
# return 0
#}
#
#report_crash ()
#{
# refresh_time
# NAME=$1
# TAIL_SIZE="100"
# DIR_ORIGINAL=$PWD
# CRASH_DIR="$(echo ${DATE}_${TIME} | sed 's/:/-/g')"
# F_NAME="${NAME}.crash"
# DIR_RELATIVE="$HOME/journal/sysadmin/crash"
# DIR_RELATIVE+="/${CRASH_DIR}"
# if [ "$#" -ne 1 ]; then
# echo "Usage: $0 FILE_NAME"
# echo "default path is $DIR_RELATIVE/FILE_NAME.crash"
# echo "write log outputs"
# return 1
# fi
#
# mkdir -p $DIR_RELATIVE
# cd $DIR_RELATIVE
# if [ -f $F_NAME ] ; then
# BCK="/tmp/$F_NAME.backup"
# echo "File exists moved to $BCK"
# mv $F_NAME $BCK
# fi
# header_journal $F_NAME
# journalctl_prettyfy "100" "1" "0" "$F_NAME"
# commit_if_modified "$F_NAME" "DELETE_IF_NOT_MODIFIED"
# cd $DIR_ORIGINAL
#}
#
#report_last_boot ()
#{
# refresh_time
# NAME=$1
# DIR_ORIGINAL=$PWD
# CRASH_DIR="$(echo ${DATE}_${TIME} | sed 's/:/-/g')"
# F_NAME="${NAME}.crash"
# DIR_RELATIVE="$HOME/journal/sysadmin/crash/reboot"
# DIR_RELATIVE+="/${CRASH_DIR}"
# if [ "$#" -ne 1 ]; then
# echo "Usage: $0 FILE_NAME"
# echo "default path is $DIR_RELATIVE/${CRASH_DIR}/FILE_NAME.crash"
# echo "write log outputs"
# return 1
# fi
#
# mkdir -p $DIR_RELATIVE
# cd $DIR_RELATIVE
# header_journal $F_NAME
# journalctl_prettyfy 500 5 1 $F_NAME
# journalctl_prettyfy 10000 5 0 $F_NAME
# commit_if_modified "$F_NAME" "DELETE_IF_NOT_MODIFIED"
# cd $DIR_ORIGINAL
#}
#
#mediaspi ()
#{
# if [ -z $1 ] ; then
# echo "usage: $0 $DIR_NAME"
# return 1
# fi
# BINAME="collector_bin"
# DEST="$HOME/perso/${BINAME}"
# DIR="${1}"
# mkdir -p $DEST
# mkdir $DIR
# if [ $? -ne 0 ] ; then
# echo "$DIR exists, must be deleted (will be anyway)"
# return 1
# fi
# find . -type f -regextype egrep -iregex ".*$MEDIA_REG" -exec cp --parents -u {} -t $DIR \;
# cp -apu $DIR -t $DEST
# rm -rf $DIR
#}
#
#conn () {
# sudo cat /var/log/connection_attempts.log
#}
#
#sortu() {
# sort | uniq -c | sort -n
#}
#
#expresso () {
# DIR="$HOME/perso/thm/interets/jeux/poker"
# HISTORY="expresso_history.md"
# SCRIPT=expresso_stat.sh
# TAIL=${1:-1000}
#
# vim + $DIR/$HISTORY
# bash $DIR/$SCRIPT $DIR/$HISTORY $TAIL
#}
#
#
#git_list_heavy_commits () {
# git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n -r | head -n 20
#}
#
#git_list_heavy () {
# for B in $(git_list_heavy_commits | cut -d' ' -f1) ; do git rev-list --all | while read commit; do git ls-tree -rl $commit; done | grep $B ; done
#}
#
#git_rm_repo () {
# KEYWORD=$1 #ex: '*.mp4'
# git filter-repo --path-glob "$KEYWORD" --invert-paths
#}
#
#
#
#
#monip () {
# curl ifconfig.me
#}
#
#ipinfo () {
# curl https://ipinfo.io/$1
#}
#
#remote () {
# USER=${1:-$LOGNAME}
# HOST=${2:-"37.187.180.32"}
# PORT=${3:-"9191"}
# sudo -u $USER ssh -l $USER -i /home/$USER/.ssh/id_rsa -p $PORT $HOST
#}
#
#remote_copy () {
# ITEM=${1:-""}
# USER=${2:-$LOGNAME}
# HOST=${3:-"37.187.180.32"}
# PORT=${4:-"9191"}
# if [ -z "$ITEM" ] ; then
# return 1
# fi
# sudo -u $USER scp -i /home/$USER/.ssh/id_rsa -P $PORT -r $ITEM $USER@$HOST:$ITEM
#}
#
#grepip () {
# grep -E $IP_REG -o $1 | sortu
#}
#
#edit-bin () {
# BIN_PATH=${BIN_PATH:-$HOME/bin}
# FILENAME=$1
# TEMPLATE=~/.vim/templates/template.my_aliases
#
# if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
# echo "Usage: $0 alias_name"
# return 1
# fi
#
# cd $BIN_PATH
# [ ! -f "$FILENAME" ] && cp "$TEMPLATE" "$FILENAME"
# commit_if_modified $FILENAME
# chmod +x $FILENAME
# cd -
#}
+142
View File
@@ -0,0 +1,142 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
if [ -f /etc/env ]; then
set -a
. /etc/env
set +a
fi
set -o vi
export EDITOR="vim"
export DATE=$(date +"%y%m%d")
export TIME=$(date +"%T")
export YEAR=$(date +"%Y")
export MONTH=$(date +"%m")
export DAY=$(date +"%d")
export USER=$(whoami)
export HOST=$(cat /etc/hostname)
export PWD_=$(pwd)
export SOURCE="$HOME/.bashrc"
export OCTET="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
export IPV4_REG="($OCTET\.){3}$OCTET"
export IPV6_REG="(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))"
export IP_REG="($IPV4_REG)|($IPV6_REG)"
MAC_REG='([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}'
export YES_REG="\$y\$[./A-Za-z0-9]+\$[./A-Za-z0-9]{,86}\$[./A-Za-z0-9]{43}"
export FILE_REG="[a-zA-Z0-9]+\.[a-zA-Z0-9]+"
export YYYY_REG="((19[5-9][0-9])|(20[0-2][0-9]))"
export MM_REG="((0?[1-9])|(1[0-2]))"
export DD_REG="((0?[1-9])|([1-2][0-9])|(3[0-1]))"
export DATE_REG="(${YYYY_REG}${MM_REG}${DD_REG})|(${DD_REGMM_REG}${YYYY_REG})"
export YYYYMMDD_REG="${YYYY_REG}${MM_REG}${DD_REG}"
export DDMMYYYY_REG="${DD_REG}${MM_REG}${YYYY_REG}"
export CFUNCTION="^[a-z].*\)$"
# --- Media File Extension Regex Patterns ---
export AUDIO_REG="mp3|wav|ogg|flac|m4a|aac|aiff|opus"
export VIDEO_REG="mp4|mkv|mov|avi|webm|wmv|flv|mpeg|mpg|3gp|m4v"
export IMAGE_REG="jpg|jpeg|png|gif|bmp|webp|tiff|ico|heic|svg|jfif"
export MEDIA_REG="\.(${AUDIO_REG}|${VIDEO_REG}|${IMAGE_REG})$"
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
PATH="$PATH:$SBIN_DIR"
PATH="$PATH:$BIN_DIR"
export PATH
export WWAN="$(ip link | grep -Eo "wwp[a-z0-9]+")"
export WLAN="$(ip link | grep -Eo "wlan[a-z0-9]+")"
case $- in
*i*) ;;
*) return;;
esac
#. /etc/bash.bashrc
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
# append to the history file, don't overwrite it
#shopt -s histappend
PROMPT_COMMAND='history -a'
export HISTTIMEFORMAT='%F %T '
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
HISTFILE=~/.history
## check the window size after each command and, if necessary,
## update the values of LINES and COLUMNS.
##shopt -s checkwinsize
#
## If set, the pattern "**" used in a pathname expansion context will
## match all files and zero or more directories and subdirectories.
##shopt -s globstar
#
## make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# Définir les couleurs
GREEN='\[\e[32m\]'
YELLOW='\[\e[33m\]'
ORANGE='\[\e[38;5;214m\]' # Il n'y a pas de code direct pour l'orange, mais ce code ANSI s'en approche
RED='\[\e[31m\]'
NO_COLOR='\[\e[0m\]' # Réinitialiser la couleur
# Définir PS1 avec les couleurs
#export PS1="\n\u@\H-\D{%y%m%d}-\t-\w\n=>"
# Couleurs
USER_COLOR="\[\e[1;32m\]" # Vert clair pour l'utilisateur
HOST_COLOR="\[\e[1;34m\]" # Bleu clair pour l'hôte
DATE_COLOR="\[\e[1;33m\]" # Jaune pour la date
TIME_COLOR="\[\e[1;36m\]" # Cyan pour l'heure
DIR_COLOR="\[\e[1;35m\]" # Magenta clair pour le répertoire
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=> "
export HISTCONTROL=ignorespace
DEVICE="$(ip addr | grep -v DOWN | grep -E "^[0-9]" | awk -F':' '{print $2}' | grep -v lo)"
export REMOTE_BRANCHES="github origin"
export LESS=-R
export AWK_GREP_KEY="'{
for (i = 1; i <= NF; i++)
if ($i ~ "^"key"=") {
split($i, a, "=")
print a[2]
}
}'"
#ctags -R .
bind -f /home/.inputrc
if [ -f /home/.bash_aliases ]; then
. /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
+237
View File
@@ -0,0 +1,237 @@
# Copyright (c) 2010 Aldo Cortesi
# Copyright (c) 2010, 2014 dequis
# Copyright (c) 2012 Randall Ma
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2012 Craig Barnes
# Copyright (c) 2013 horsik
# Copyright (c) 2013 Tao Sauvage
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import os
import libqtile.resources
from libqtile import bar, layout, qtile, widget
from libqtile.config import Click, Drag, Group, Key, Match, Screen
from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
mod = "mod4"
terminal = guess_terminal()
keys = [
Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"),
Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"),
Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"),
Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"),
Key([mod, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"),
Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"),
Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"),
Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"),
Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
# Toggle between split and unsplit sides of stack.
# Split = all windows displayed
# Unsplit = 1 window displayed, like Max layout, but still with
# multiple stack panes
Key(
[mod, "shift"],
"Return",
lazy.layout.toggle_split(),
desc="Toggle between split and unsplit sides of stack",
),
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
# Toggle between different layouts as defined below
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
Key(
[mod],
"f",
lazy.window.toggle_fullscreen(),
desc="Toggle fullscreen on the focused window",
),
Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"),
Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
Key([], "XF86AudioRaiseVolume", lazy.widget["vol"].increase_vol()),
Key([], "XF86AudioLowerVolume", lazy.widget["vol"].decrease_vol()),
Key([], "XF86AudioMute", lazy.widget["vol"].mute()),
]
# Add key bindings to switch VTs in Wayland.
# We can't check qtile.core.name in default config as it is loaded before qtile is started
# We therefore defer the check until the key binding is run by using .when(func=...)
for vt in range(1, 8):
keys.append(
Key(
["control", "mod1"],
f"f{vt}",
lazy.core.change_vt(vt).when(func=lambda: qtile.core.name == "wayland"),
desc=f"Switch to VT{vt}",
)
)
groups = [Group(i) for i in "123456789"]
for i in groups:
keys.extend(
[
# mod + group number = switch to group
Key(
[mod],
i.name,
lazy.group[i.name].toscreen(),
desc=f"Switch to group {i.name}",
),
# mod + shift + group number = switch to & move focused window to group
Key(
[mod, "shift"],
i.name,
lazy.window.togroup(i.name, switch_group=True),
desc=f"Switch to & move focused window to group {i.name}",
),
# Or, use below if you prefer not to switch to that group.
# # mod + shift + group number = move focused window to group
# Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
# desc="move focused window to group {}".format(i.name)),
]
)
layouts = [
layout.Columns(border_focus_stack=["#d75f5f", "#8f3d3d"], border_width=4),
layout.Max(),
# Try more layouts by unleashing below layouts.
# layout.Stack(num_stacks=2),
# layout.Bsp(),
# layout.Matrix(),
# layout.MonadTall(),
# layout.MonadWide(),
# layout.RatioTile(),
# layout.Tile(),
# layout.TreeTab(),
# layout.VerticalTile(),
# layout.Zoomy(),
]
widget_defaults = dict(
font="sans",
fontsize=9,
padding=3,
)
extension_defaults = widget_defaults.copy()
logo = os.path.join(os.path.dirname(libqtile.resources.__file__), "~/.config/qtile/enso.png")
def my_bar():
return bar.Bar(
[
widget.CurrentLayout(),
widget.GroupBox(),
widget.Prompt(),
widget.WindowName(),
widget.Chord(
chords_colors={
"launch": ("#ff0000", "#ffffff"),
},
name_transform=lambda name: name.upper(),
),
# widget.StatusNotifier(),
widget.Systray(),
widget.Clock(format="%Y-%m-%d %a %I:%M %p"),
widget.QuickExit(),
],
24,
)
screens = [
Screen(
background="#000000",
wallpaper=logo,
wallpaper_mode="center",
bottom=my_bar()
# x=1600,y=0
# width=1920, height=1080
),
Screen = [
bottom=my_bar()
background="#000000",
wallpaper=logo,
wallpaper_mode="center",
# x=0,y=0
# width=1600, height=900
]
]
# Drag floating layouts.
mouse = [
Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
Click([mod], "Button2", lazy.window.bring_to_front()),
]
dgroups_key_binder = None
dgroups_app_rules = [] # type: list
follow_mouse_focus = True
bring_front_click = False
floats_kept_above = True
cursor_warp = False
floating_layout = layout.Floating(
float_rules=[
# Run the utility of `xprop` to see the wm class and name of an X client.
*layout.Floating.default_float_rules,
Match(wm_class="confirmreset"), # gitk
Match(wm_class="makebranch"), # gitk
Match(wm_class="maketag"), # gitk
Match(wm_class="ssh-askpass"), # ssh-askpass
Match(title="branchdialog"), # gitk
Match(title="pinentry"), # GPG key password entry
]
)
auto_fullscreen = True
focus_on_window_activation = "smart"
focus_previous_on_window_remove = False
reconfigure_screens = True
# If things like steam games want to auto-minimize themselves when losing
# focus, should we respect this or not?
auto_minimize = True
# When using the Wayland backend, this can be used to configure input devices.
wl_input_rules = None
# xcursor theme (string or None) and size (integer) for Wayland backend
wl_xcursor_theme = None
wl_xcursor_size = 24
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
# string besides java UI toolkits; you can see several discussions on the
# mailing lists, GitHub issues, and other WM documentation that suggest setting
# this string if your java app doesn't work correctly. We may as well just lie
# and say that we're a working one by default.
#
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
# java that happens to be on java's whitelist.
wmname = "LG3D"
+25
View File
@@ -0,0 +1,25 @@
set editing-mode vi
"\e[A": history-search-backward
"\e[B": history-search-forward
# For vi command mode
set keymap vi-command
"\e[A": history-search-backward
"\e[B": history-search-forward
"\eOA": history-search-backward
"\eOB": history-search-forward
# For vi insert mode
set keymap vi-insert
"\e[A": history-search-backward
"\e[B": history-search-forward
"\eOA": history-search-backward
"\eOB": history-search-forward
# Other settings
set completion-ignore-case on
set show-all-if-ambiguous on
set bell-style none
set match-hidden-files off
+1
View File
@@ -0,0 +1 @@
source /home/.profile
+9
View File
@@ -0,0 +1,9 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhistcnt =7
let g:netrw_dirhist_7='/home/archi/machine/networking'
let g:netrw_dirhist_6='/home/k/bs/shy-ni/haikus'
let g:netrw_dirhist_5='/home/k/bs/shy-ni/scenes'
let g:netrw_dirhist_4='/home/k/bs/shy-ni'
let g:netrw_dirhist_3='/home/k/bs/shy-ni/haikus'
let g:netrw_dirhist_2='/home/k/bs/shy-ni'
let g:netrw_dirhist_1='/home/k/machine/networking'
+19
View File
@@ -0,0 +1,19 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* template.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nidionis <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/04 16:20:59 by nidionis #+# #+# */
/* Updated: 2024/09/05 14:15:32 by nidionis ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv)
{
return (0);
}
View File
@@ -0,0 +1,25 @@
#!/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
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import argparse
def parse_args():
parser = argparse.ArgumentParser(
description="Template script using argparse"
)
parser.add_argument(
"-i", "--input",
type=str,
help="Input file path",
required=True
)
parser.add_argument(
"-o", "--output",
type=str,
help="Output file path",
required=False
)
parser.add_argument(
"-v", "--verbose",
action="store_true",
help="Enable verbose mode"
)
parser.add_argument(
"--mode",
choices=["fast", "slow"],
default="fast",
help="Choose mode of operation"
)
return parser.parse_args()
def main():
args = parse_args()
if args.verbose:
print("[INFO] Verbose mode is on")
print(f"[INFO] Input file: {args.input}")
print(f"[INFO] Output file: {args.output or 'stdout'}")
print(f"[INFO] Mode selected: {args.mode}")
# Example processing
with open(args.input, 'r') as f:
data = f.read()
result = data.upper() if args.mode == "fast" else data.lower()
if args.output:
with open(args.output, 'w') as f:
f.write(result)
else:
print(result)
if __name__ == "__main__":
main()
+25
View File
@@ -0,0 +1,25 @@
#!/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
+12
View File
@@ -0,0 +1,12 @@
services:
web:
build: .
ports:
- "8000:5000"
develop:
watch:
- action: sync
path: .
target: /code
redis:
image: "redis:alpine"
+104
View File
@@ -0,0 +1,104 @@
" https://www.freecodecamp.org/news/vimrc-configuration-guide-customize-your-vim-editor/
" Disable compatibility with vi which can cause unexpected issues.
set nocompatible
" Enable type file detection. Vim will be able to try to detect the type of file is use.
filetype on
" Enable plugins and load plugin for the detected file type.
filetype plugin on
" Load an indent file for the detected file type.
filetype indent on
" Turn syntax highlighting on.
syntax on
" Add numbers to the file.
set number
" Highlight cursor line underneath the cursor horizontally.
"set cursorline
" Highlight cursor line underneath the cursor vertically.
"set cursorcolumn
" Set shift width to 4 spaces.
set shiftwidth=4
" Set tab width to 4 columns.
set tabstop=4
" Use space characters instead of tabs.
"set expandtab
" Do not save backup files.
" set nobackup
set backupdir=/tmp
" Do not let cursor scroll below or above N number of lines when scrolling.
set scrolloff=10
" Do not wrap lines. Allow long lines to extend as far as the line goes.
"set nowrap
" While searching though a file incrementally highlight matching characters as you type.
set incsearch
" Ignore capital letters during search.
set ignorecase
" Override the ignorecase option if searching for capital letters.
" This will allow you to search specifically for capital letters.
set smartcase
" Show partial command you type in the last line of the screen.
set showcmd
" Show the mode you are on the last line.
"set showmode
" Show matching words during a search.
set showmatch
" Use highlighting when doing a search.
set hlsearch
" Set the commands to save in history default number is 20.
set history=1000
" Enable auto completion menu after pressing TAB.
set wildmenu
" Make wildmenu behave like similar to Bash completion.
"set wildmode=list:longest
" There are certain files that we would never want to edit with Vim.
" Wildmenu will ignore files with these extensions.
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
" skeletons
autocmd BufNewFile *.sh 0r ./.vim/templates/template.sh
autocmd BufNewFile *.py 0r ./.vim/templates/template.py
autocmd BufNewFile *.c 0r ./.vim/templates/template.c
set mouse=a
inoremap {{ {}<ESC>O
inoremap {;{ ;}<ESC>O
:nnoremap <Space> @q
set rnu
set directory=/tmp
colorscheme koehler
set tags=./tags;,tags;
syntax on
set tags=./tags;/