diff options
| author | littleblack111 <jerrylam110209@gmail.com> | 2023-03-27 21:25:48 +0800 |
|---|---|---|
| committer | littleblack111 <jerrylam110209@gmail.com> | 2023-03-27 21:25:48 +0800 |
| commit | e1e366d8a401ff6cb6906af0e0fa756932c798ec (patch) | |
| tree | b375dcb4f88d436c5ed5c5b66f3aa7433d7d4f8a | |
| parent | 6a731444376c853ff8831ab4e0575302049ed27b (diff) | |
added compile script apply for most languages
| -rwxr-xr-x | compile | 63 | ||||
| -rwxr-xr-x | compilerun | 83 | ||||
| -rwxr-xr-x | nix-install | 3 | ||||
| -rwxr-xr-x | reflector.sh | 2 | ||||
| -rwxr-xr-x | vimake | 5 | ||||
| -rwxr-xr-x | xkill-current-windows.sh | 7 |
6 files changed, 161 insertions, 2 deletions
@@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +RED='\033[0;31m' +NC='\033[0m' # No Color + +if [[ ${1##*.} == "asm" ]]; then + printf "\$ nasm -f elf64 -g -F dwarf $1 -l ${1%.*}.lst -o ${1%.*}.o\n" + nasm -f elf64 -g -F dwarf $1 -l ${1%.*}.lst -o ${1%.*}.o + printf "compiled into ${1%.*}.o\n" + printf "\$ ld ${1%.*}.o -o ${1%.*}" + ld ${1%.*}.o -o ${1%.*} + printf "linked into ${1%.*}\n" + printf "compiled into executable" +elif [[ ${1##*.} == "c" || ${1##*.} == "cc" ]]; then + printf "\$ gcc $1 -o ${1%.*}\n" + gcc $1 -o ${1%.*} + printf "compiled into ${1%.*}\n" +elif [[ ${1##*.} == "cpp" ]]; then + printf "\$ g++ $1 -o ${1%.*}\n" + g++ $1 -o ${1%.*} + printf "compiled into ${1%.*}\n" +elif [[ ${1##*.} == "go" ]]; then + printf "\$ go build $1\n" + go build $1 + printf "compiled into ${1%.*}\n" +elif [[ ${1##*.} == "cs" ]]; then + printf "\$ csc $1\n" + csc $1 + printf "compiled into ${1%.*}.exe\n" +elif [[ ${1##*.} == "java" ]]; then + printf "\$ javac $1\n" + javac $1 + printf "compiled into ${1%.*}.class\n" +elif [[ ${1##*.} == "py" ]]; then + printf "\$ python -m py_compile $1\n" + python -m py_compile $1 + printf "compiled into ${1%.*}.pyc\n" +elif [[ ${1##*.} == "rb" ]]; then + printf "\$ ruby -wc $1\n" + ruby -wc $1 + printf "compiled into ${1%.*}\n" +elif [[ ${1##*.} == "js" ]]; then + printf "\$ node $1\n" + node $1 + printf "compiled into ${1%.*}\n" +elif [[ ${1##*.} == "ts" ]]; then + printf "\$ tsc $1\n" + tsc $1 + printf "compiled into ${1%.*}.js\n" +elif [[ ${1##*.} == "dart" ]]; then + printf "\$ dart compile exe $1\n" + dart compile exe $1 + printf "compiled into ${1%.*}\n" +elif [[ ${1##*.} == "rs" ]]; then + printf "\$ rustc $1\n" + rustc $1 + printf "compiled into ${1%.*}\n" +elif [ -e "Makefile" ]; then + make + sudo make install +else + printf "${RED}ERROR: nothing compiled.\n" +fi diff --git a/compilerun b/compilerun new file mode 100755 index 0000000..508b838 --- /dev/null +++ b/compilerun @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +RED='\033[0;31m' +NC='\033[0m' # No Color + +if [[ ${1##*.} == "asm" ]]; then + printf "\$ nasm -f elf64 -g -F dwarf $1 -l ${1%.*}.lst -o ${1%.*}.o\n" + nasm -f elf64 -g -F dwarf $1 -l ${1%.*}.lst -o ${1%.*}.o + printf "compiled into ${1%.*}.o\n" + printf "\$ ld ${1%.*}.o -o ${1%.*}" + ld ${1%.*}.o -o ${1%.*} + printf "linked into ${1%.*}\n" + printf "compiled into executable ${1%.*}" + printf "Running \"${1%.*}\"\n\n" + ./${1%.*} +elif [[ ${1##*.} == "c" || ${1##*.} == "cc" ]]; then + printf "\$ gcc $1 -o ${1%.*}\n" + gcc $1 -o ${1%.*} + printf "compiled into ${1%.*}\n" + printf "Running \"${1%.*}\"\n\n" + ./${1%.*} +elif [[ ${1##*.} == "cpp" ]]; then + printf "\$ g++ $1 -o ${1%.*}\n" + g++ $1 -o ${1%.*} + printf "compiled into ${1%.*}\n" + printf "Running \"${1%.*}\"\n\n" + ./${1%.*} +elif [[ ${1##*.} == "go" ]]; then + printf "\$ go build $1\n" + go build $1 + printf "compiled" + printf "Running \$ go run $1" + go run $1 +elif [[ ${1##*.} == "cs" ]]; then + printf "\$ csc $1\n" + csc $1 + printf "compiled into ${1%.*}.exe\n" + printf "Running \"${1%.*}\"\n\n" + mono ${1%.*}.exe +elif [[ ${1##*.} == "java" ]]; then + printf "\$ javac $1\n" + javac $1 + printf "compiled into ${1%.*}.class\n" + printf "Running \"${1%.*}\"\n\n" + java ${1%.*} +elif [[ ${1##*.} == "py" ]]; then + printf "\$ pyinstaller -F $1\n" + pyinstaller -F $1 + printf "Running \"./dist/${1%.*}\"" + ./dist/${1%.*} +#elif [[ ${1##*.} == "rb" ]]; then + #printf "\$ ruby -wc $1\n" + #ruby -wc $1 + #printf "compiled into ${1%.*}\n" + #printf "Running ${1%.*}" + #ruby $1 +elif [[ ${1##*.} == "js" ]]; then + printf "\$ node $1\n" + node $1 + printf "Running $1" +elif [[ ${1##*.} == "ts" ]]; then + printf "\$ tsc $1\n" + tsc $1 + printf "compiled into ${1%.*}.js\n" + printf "Running \$ ts-node $1" + ts-node $1 +elif [[ ${1##*.} == "dart" ]]; then + printf "\$ dart compile exe $1\n" + dart compile exe $1 + printf "compiled into ${1%.*}\n" + printf "Running \$ dart $1" + dart $1 +elif [[ ${1##*.} == "rs" ]]; then + printf "\$ rustc $1\n" + rustc $1 + printf "compiled into ${1%.*}\n" + printf "Running \$ ./${1%.*}" +elif [ -e "Makefile" ]; then + make + sudo make install +else + printf "${RED}ERROR: nothing compiled or runed.\n" +fi diff --git a/nix-install b/nix-install new file mode 100755 index 0000000..6fca252 --- /dev/null +++ b/nix-install @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +nix-env -iA nixpkgs.$@ diff --git a/reflector.sh b/reflector.sh index 92c6453..c99ab8c 100755 --- a/reflector.sh +++ b/reflector.sh @@ -1,6 +1,6 @@ #!/usr/bin/bash while true; do #sudo #exec sudo /usr/bin/reflector @/etc/xdg/reflector/reflector.conf & - sudo npm update -g & pipx upgrade-all & yay -Syu --noconfirm --disable-download-timeout && flatpak update -y + sudo npm update -g & pipx upgrade-all & nix-env -u & yay -Syu --noconfirm --disable-download-timeout && flatpak update -y sleep 1080 done @@ -1 +1,4 @@ -lvim Makefile +if [ -e "Makefile" ]; then + lvim Makefile +else + printf "No Makefile" diff --git a/xkill-current-windows.sh b/xkill-current-windows.sh new file mode 100755 index 0000000..234c011 --- /dev/null +++ b/xkill-current-windows.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Get the ID of the active window +active_window=$(xprop -root _NET_ACTIVE_WINDOW | awk '{print $5}') + +# Use xkill to kill only the active window +xkill -id $active_window |
