diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2025-05-21 14:30:00 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2025-05-21 14:30:00 +0530 |
commit | 0d397e4d3d204a1e016c0863815f0b5dc516c46b (patch) | |
tree | 5e5db5a8b53555783ca3b5679bc21876e9de0b6c /.local/bin/development | |
parent | e55ad8ca4f99fa024106d5695a55f9ac132d7b68 (diff) |
added some new scripts and cleaned up nvim directory
Diffstat (limited to '.local/bin/development')
-rwxr-xr-x | .local/bin/development/font2svg | 3 | ||||
-rwxr-xr-x | .local/bin/development/gitpush | 6 | ||||
-rwxr-xr-x | .local/bin/development/nx | 85 |
3 files changed, 6 insertions, 88 deletions
diff --git a/.local/bin/development/font2svg b/.local/bin/development/font2svg new file mode 100755 index 0000000..539972d --- /dev/null +++ b/.local/bin/development/font2svg @@ -0,0 +1,3 @@ +#!/bin/sh + +fontforge -c "import fontforge; fontforge.open('$1').generate('${1%.*}.svg')" diff --git a/.local/bin/development/gitpush b/.local/bin/development/gitpush index 7774a7b..2c503ca 100755 --- a/.local/bin/development/gitpush +++ b/.local/bin/development/gitpush @@ -1,12 +1,6 @@ #!/bin/sh push_to_remote() { - case "$(git config --get remote.origin.url)" in - *csstudent41*) sshadd ~/.ssh/github.com_id_ed25519 ;; - *labstudent41*) sshadd ~/.ssh/labstudent41_id_ed25519 ;; - *vtc-tech*) sshadd ~/.ssh/vartaktechclub_id_ed25519 ;; - esac - git add --all git commit && git push -u origin } diff --git a/.local/bin/development/nx b/.local/bin/development/nx index 862be99..8305487 100755 --- a/.local/bin/development/nx +++ b/.local/bin/development/nx @@ -21,7 +21,7 @@ shift $((OPTIND - 1)) [ "$#" -gt 1 ] && err "too many arguments. Only one expected" -new_script() { +new_file() { cat << EOF > "$1" #!/bin/sh @@ -47,77 +47,8 @@ EOF chmod u+x -- "$1" || exit } - -new_c_file() { - cat << EOF > "$1" -#include <stdio.h> - -int main() -{ - printf("Hello\n"); - - return 0; -} -EOF -} - - -new_cpp_file() { - cat << EOF > "$1" -#include <iostream> - -using namespace std; - -int main() -{ - cout << "Hello" << endl; - - cin.get(); - return 0; -} -EOF -} - - -new_py_file() { - cat << EOF > "$1" -import timeit - -print("Finished in %fs" % timeit.timeit()) -EOF -} - - -new_java_file() { - PATTERN="Scanner" - VIMCMDS="normal!2n\n noh" - cat << EOF > "$1" -import java.util.Scanner; - -class ${1%.java} { - public static void main(String args[]) { - Scanner sc = new Scanner(System.in); - - System.out.println("Finished!"); - sc.close - } -} -EOF -} - - file="$1" -new_file() { - case "$file" in - *.c) new_c_file "$file" ;; - *.cpp) new_cpp_file "$file" ;; - *.py) new_py_file "$file" ;; - *.java) new_java_file "$file" ;; - *) new_script "$file" ;; - esac -} - if [ -f "$file" ]; then [ ! -w "$file" ] && chmod u+rw "$file" if [ -s "$file" ]; then @@ -134,15 +65,5 @@ fi ls -lF --color -- "$file" -case "$EDITOR" in - '') echo "$0: \$EDITOR variable not set" >&2 && exit 1 ;; - vi|*vim*) - VIMCONF="$(mktemp)"; export VIMCONF - [ -n "$VIOPTS" ] && echo "set $VIOPTS" >> "$VIMCONF" - [ -n "$PATTERN" ] && echo "/$PATTERN" >> "$VIMCONF" - [ -n "$VIMCMDS" ] && echo "$VIMCMDS" >> "$VIMCONF" - $EDITOR -S "$VIMCONF" "$file" - rm -f "$VIMCONF" - ;; - *) $EDITOR "$file" ;; -esac; exit +${EDITOR} "$file" + |