Compare commits

...

3 Commits

Author SHA1 Message Date
Timo Schmidt 00cf30350f Moulinette params 2023-03-28 15:03:40 +02:00
Timo Schmidt 3b4068fac9 timo_moulinette 2023-03-28 14:22:38 +02:00
Timo Schmidt 34224276c6 .bashrc 2023-03-28 13:02:13 +02:00
1 changed files with 46 additions and 41 deletions

35
.bashrc
View File

@ -1,3 +1,4 @@
alias l='ls -larthF --color=auto'
alias v='vim'
alias ..='cd ..'
alias ...='cd ../..'
@ -6,15 +7,14 @@ alias ft='cc -Wall -Wextra -Werror -o main -xc -- <(grep -v "////" *.c) && ./mai
alias ft2='cc -Wall -Wextra -Werror -o main -xc -- <(grep -v "////" *.c) && ./main'
alias git='EDITOR=vim git'
alias cmatrix='cmatrix -cu3 -Cred'
alias gca='git add * && git commit -m *'
alias gca='git add -u && git commit -m *'
alias watch='watch -cn.1'
alias push='git push origin master ; git push gitea master'
alias norm='alacritty -e sh -c '\''git rev-parse --show-toplevel || { echo "Exiting in 5" ; sleep 1 ; echo "Exiting in 4" ; sleep 1 ; echo "Exiting in 3" ; sleep 1 ; echo "Exiting in 2" ; sleep 1 ; echo "Exiting in 1" ; sleep 1 ; } && cd "$(git rev-parse --show-toplevel)" && watch -cn.5 date \&\& norminette -R CheckForbiddenSourceHeader'\'' & disown'
alias l='ls -larthF --color=auto'
jmp () {
cd "$(find . -name "${1}" -print -quit)"
cd "$(find . -name "${1}" -not -wholename "*mouli*" -print -quit)"
if [ "${?}" = "0" ] ; then
cd "$(find .. -name "${1}" -print -quit)"
cd "$(find .. -name "${1}" -not -wholename "*mouli*" -print -quit)"
fi
}
@ -22,14 +22,14 @@ xset r rate 200 60
PATH="${PATH}:/nfs/homes/tischmid/.local/bin"
if [ -f ~/git-prompt.sh ]; then
. ~/git-prompt.sh
else
source <(curl --silent --location 'https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh')
fi
export GIT_PS1_SHOWDIRTYSTATE=1
PS1='\[\033[31m\]\u\[\033[m\]@\[\033[32m\]\h\[\033[m\] \[\033[33m\][\w]\[\033[m\]\[\033[36m\]$(__git_ps1 " (%s)")\[\033[m\]\n$ '
# if [ ! -f ~/git-prompt.sh ] ; then
# curl --silent --location 'https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh' -o "~/git-prompt.sh"
# fi
#
# . ~/git-prompt.sh
# export GIT_PS1_SHOWDIRTYSTATE=1
# PS1='\[\033[31m\]\u\[\033[m\]@\[\033[32m\]\h\[\033[m\] \[\033[33m\][\w]\[\033[m\]\[\033[36m\]$(__git_ps1 " (%s)")\[\033[m\]\n$ '
PS1='\[\033[31m\]\u\[\033[m\]@\[\033[32m\]\h\[\033[m\] \[\033[33m\][\w]\[\033[m\]\[\033[36m\]\[\033[m\]\n$ '
##-----------------------------------------------------
## synth-shell-greeter.sh
@ -97,6 +97,7 @@ timo_moulinette () {
# Set params
subject="${1}"
ex="${2}"
extras="${3}"
# Arghandle
if [ -z "${subject}" ] ; then
@ -124,7 +125,7 @@ timo_moulinette () {
git_base="https://git.timo.one/42berlin/piscine-timo-moulinette/raw/branch/master"
# Find the first C file
file_name="$(find . -mindepth 1 -maxdepth 1 -name '*.c' ! -name '*moulinette*' -type f -exec basename {} \; -quit)"
file_name="$(find . -mindepth 1 -maxdepth 1 -name '*.c' -not -name '*mouli*' -type f -exec basename {} \; -quit)"
# If no C files found, exit
if [ -z "${file_name}" ] ; then
@ -148,7 +149,7 @@ timo_moulinette () {
${CC} -dD -E -o "${file_name}.nocomments" -- "${file_name}"
# Extract function definitions from preprocessed file and append semicolon
prototypes="$(cat -- "${file_name}.nocomments" | grep -v '#' | grep ')$' | grep '[a-zA-Z0-9](' | grep -v 'int[[:space:]]\+main(' | sed 's/$/;/')"
prototypes="$(cat -- "${file_name}.nocomments" | grep -v '#' | grep ')$' | grep -v ' (' | grep -v ' ' | grep '[a-zA-Z0-9](' | grep -v 'int[[:space:]]\+main(' | sed 's/$/ ;/')"
# Extract macros from file (ignore the ones with line continuations)
macros="$(cat -- "${file_name}" | grep '^#' | grep -v '\\$')"
@ -199,11 +200,15 @@ timo_moulinette () {
fi
# Delete testfile
if [ "$(printf '%s' "${extras}" | sed 's/keep-test//g')" = "${extras}" ] ; then
rm -f -- "${download_file_name}"
fi
# Run binary
./${out_binary}
# rm -f -- "./${out_binary}"
if [ "${?}" = "0" ] && [ "$(printf '%s' "${extras}" | sed 's/keep-binary//g')" = "${extras}" ] ; then
rm -f -- "./${out_binary}"
fi
}
prev () {