]> localhost Git - dotfiles.git/commitdiff
Add more dotfiles
authorMisomosi <[email protected]>
Sun, 3 Nov 2024 16:16:55 +0000 (11:16 -0500)
committerMisomosi <[email protected]>
Sun, 3 Nov 2024 16:16:55 +0000 (11:16 -0500)
.config/git/hooks/pre-commit [new file with mode: 0755]
.config/git/ignore
.local/bin/asvarsall.sh [new file with mode: 0644]
.vimrc [new file with mode: 0644]
README.md

diff --git a/.config/git/hooks/pre-commit b/.config/git/hooks/pre-commit
new file mode 100755 (executable)
index 0000000..6770abb
--- /dev/null
@@ -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 --
index f1b5895c9d3e76d03fdc65250872e98181cd07c4..8a164bdf5e11063c89fd0926b995b0d76ca6c9d3 100644 (file)
@@ -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 (file)
index 0000000..a271aa1
--- /dev/null
@@ -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 (file)
index 0000000..8ef5a28
--- /dev/null
+++ b/.vimrc
@@ -0,0 +1 @@
+source ~/.exrc
index e7e273444c5dc41e1b0d3dc75ad231766ed798c3..272658311a53775199ee2c42b696f892d3462b8e 100644 (file)
--- 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"
+```