From a467be723844d8912074d011d753987788b8203f Mon Sep 17 00:00:00 2001 From: Misomosi Date: Sun, 3 Nov 2024 11:16:55 -0500 Subject: [PATCH] Add more dotfiles --- .config/git/hooks/pre-commit | 29 +++++++++++++++++ .config/git/ignore | 3 +- .local/bin/asvarsall.sh | 14 +++++++++ .vimrc | 1 + README.md | 61 ++++++++++++++++++++++++++++++++++-- 5 files changed, 104 insertions(+), 4 deletions(-) create mode 100755 .config/git/hooks/pre-commit create mode 100644 .local/bin/asvarsall.sh create mode 100644 .vimrc diff --git a/.config/git/hooks/pre-commit b/.config/git/hooks/pre-commit new file mode 100755 index 0000000..6770abb --- /dev/null +++ b/.config/git/hooks/pre-commit @@ -0,0 +1,29 @@ +#!/bin/sh + +# Default pre-commit hook script by git +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + against=$(git hash-object -t tree /dev/null) +fi +allownonascii=$(git config --type=bool hooks.allownonascii) +exec 1>&2 +if [ "$allownonascii" != "true" ] && + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi +exec git diff-index --check --cached $against -- diff --git a/.config/git/ignore b/.config/git/ignore index f1b5895..8a164bd 100644 --- a/.config/git/ignore +++ b/.config/git/ignore @@ -1,6 +1,7 @@ -# Files produced by .gdbinit and frields +# Files produced by .gdbinit and friends .breakpoints .gdb_history +core* # Scripts I use in git repos to automate certain niceties *.i.sh diff --git a/.local/bin/asvarsall.sh b/.local/bin/asvarsall.sh new file mode 100644 index 0000000..a271aa1 --- /dev/null +++ b/.local/bin/asvarsall.sh @@ -0,0 +1,14 @@ +#!/bin/sh +if [ "$ANDROID_SDK_HOME" = "" ] ; then + export ANDROID_SDK_HOME="$HOME"/Android/Sdk +fi +if [ "$ANDROID_NDK_HOME" = "" ] ; then + cd "$ANDROID_SDK_HOME"/ndk + export ANDROID_NDK_HOME="$PWD/$(ls -v | tr ' ' '\n' | head -1)" + cd $OLDPWD +fi +PLATFORM_BIN="$ANDROID_SDK_HOME/platform-tools" +CMDLINE_BIN="$ANDROID_SDK_HOME/cmdline-tools/latest/bin" +LLVM_BIN="$(echo "$ANDROID_NDK_HOME"/toolchains/llvm/prebuilt/linux-*/bin)" +export PATH="$LLVM_BIN:$CMDLINE_BIN:$PLATFORM_BIN:$PATH" +"$SHELL" diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..8ef5a28 --- /dev/null +++ b/.vimrc @@ -0,0 +1 @@ +source ~/.exrc diff --git a/README.md b/README.md index e7e2734..2726583 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Worry not because my dotfiles have come to the rescue dotfiles so simple, they fit on a page -## .vimrc / .exrc +## .exrc ``` set autoindent set ignorecase @@ -19,6 +19,11 @@ set showmode set wrapscan ``` +## .vimrc +``` +source ~/.exrc +``` + ## .tmux.conf ``` # I may or may not have protanopia so this makes the contrast higher while still looking green to me @@ -55,7 +60,7 @@ alias tmux-copy="tmux show-buffer | wl-copy" alias tmux-paste="wl-paste" ``` -## .local/bin/gdb-posix +## gdb-posix ``` #!/bin/sh # Producing coredumps on segfaults is usually what I want by default @@ -80,9 +85,10 @@ Host github.com ## .gitignore ``` -# Files produced by .gdbinit and frields +# Files produced by .gdbinit and friends .breakpoints .gdb_history +core* # Scripts I use in git repos to automate certain niceties *.i.sh @@ -101,3 +107,52 @@ Host github.com *.elf *.out ``` + +## pre-commit +``` +# Default pre-commit hook script by git +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + against=$(git hash-object -t tree /dev/null) +fi +allownonascii=$(git config --type=bool hooks.allownonascii) +exec 1>&2 +if [ "$allownonascii" != "true" ] && + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi +exec git diff-index --check --cached $against -- +``` + +## asvarsall.sh (Android Studio) +```sh +#!/bin/sh +if [ "$ANDROID_SDK_HOME" = "" ] ; then + export ANDROID_SDK_HOME="$HOME"/Android/Sdk +fi +if [ "$ANDROID_NDK_HOME" = "" ] ; then + cd "$ANDROID_SDK_HOME"/ndk + export ANDROID_NDK_HOME="$PWD/$(ls -v | tr ' ' '\n' | head -1)" + cd $OLDPWD +fi +PLATFORM_BIN="$ANDROID_SDK_HOME/platform-tools" +CMDLINE_BIN="$ANDROID_SDK_HOME/cmdline-tools/latest/bin" +LLVM_BIN="$(echo "$ANDROID_NDK_HOME"/toolchains/llvm/prebuilt/linux-*/bin)" +export PATH="$LLVM_BIN:$CMDLINE_BIN:$PLATFORM_BIN:$PATH" +"$SHELL" +``` -- 2.49.1