This commit is contained in:
Josh Ashton
2023-08-03 10:52:40 -06:00
parent fbf5b4308d
commit c43e89cff3
8 changed files with 37 additions and 70 deletions
-41
View File
@@ -1,41 +0,0 @@
#!/bin/zsh
# Dependencies:
# quaxlyqueen/scripts/mark
BOOKMARKS_FILE=~/.bookmarks
# Catch any invalid input.
if [[ $# -eq 0 || $# -gt 1 ]]; then
echo "\nImproper usage. Try:"
echo "\ngoto [keyword]"
echo " goto downloads"
echo " goto school"
echo " goto portfolio"
echo " goto -h"
echo " goto --help"
# Display help.
elif [[ $1 == "-h" || $1 == "--help" ]]; then
echo "\nImproper usage. Try:"
echo "\ngoto [keyword]"
echo " goto downloads"
echo " goto school"
echo " goto portfolio"
echo " goto -h"
echo " goto --help"
else
# Locate the bookmark.
if [ $(grep -c "$1" $BOOKMARKS_FILE) -gt 0 ]; then
# Go to the bookmark
cd $(grep "$1" $BOOKMARKS_FILE | head -n 1)
# List bookmarks if bookmark was not found.
else
echo "Bookmark not found. Available bookmarks:"
mark -ls
fi
fi
+14 -1
View File
@@ -8,7 +8,7 @@
# quaxlyqueen/scripts/ginit # quaxlyqueen/scripts/ginit
# Supported languages. # Supported languages.
TYPES=("c", "c-sharp", "java", "js", "t3", "python", "flutter", "go") TYPES=("c", "rust", "c-sharp", "java", "js", "t3", "python", "flutter", "go")
# Catch case where there are too many arguments. # Catch case where there are too many arguments.
if [[ $# -gt 3 ]]; then if [[ $# -gt 3 ]]; then
@@ -91,6 +91,15 @@ if [[ $LANG == "c" ]]; then
cp -r ~/templates/c/main.c . # Copy the template C file. cp -r ~/templates/c/main.c . # Copy the template C file.
mark; # Bookmark new project. mark; # Bookmark new project.
# Create a new Rust project.
elif [[ $LANG == "rust" ]]; then
read "?Is this an Arduino project? (y/N): " ARDUINO
if [[ $ARDUINO == "y" ]]; then
cargo generate --git https://github.com/Rahix/avr-hal-template.git
else
cargo new $NAME
fi
# Create a new C# project with dotnet. # Create a new C# project with dotnet.
elif [[ $LANG == "c-sharp" ]]; then elif [[ $LANG == "c-sharp" ]]; then
mkdir $NAME mkdir $NAME
@@ -137,6 +146,10 @@ elif [[ $LANG == "flutter" ]]; then
cd $NAME cd $NAME
mark; mark;
# Create a new t3 web app.
elif [[ $LANG == "t3" ]]; then
npm create t3-app@latest
fi fi
# If the user indicated the project will be a Git project, then run the ginit script. # If the user indicated the project will be a Git project, then run the ginit script.
+6 -1
View File
@@ -1,7 +1,7 @@
#!/bin/zsh #!/bin/zsh
# Supported languages. # Supported languages.
TYPES=("c", "cs", "java", "js", "python", "flutter", "gradle", "go") TYPES=("c", "rs", "cs", "java", "js", "python", "flutter", "gradle", "go")
# Catch case where there are too many arguments. # Catch case where there are too many arguments.
if [[ $# -gt 1 ]]; then if [[ $# -gt 1 ]]; then
@@ -99,6 +99,11 @@ if [[ $TYPE == "c" ]]; then
rm a.out rm a.out
# Run a Rust app.
elif [[ $TYPE == "rs" ]]; then
clear
cargo run
# Run C# app. # Run C# app.
elif [[ $TYPE == "cs" ]]; then elif [[ $TYPE == "cs" ]]; then
clear clear
BIN
View File
Binary file not shown.
+3 -1
View File
@@ -42,7 +42,9 @@ void validateDir(char input[]) {
printf("cwd: %s\n", cwd); printf("cwd: %s\n", cwd);
} }
chdir(".."); chdir("..");
printf("cwd: %s", cwd); if(getcwd(cwd, sizeof(cwd)) != NULL) {
printf("cwd: %s\n", cwd);
}
} }
} }
BIN
View File
Binary file not shown.
-9
View File
@@ -1,9 +0,0 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main() {
printf("%s", getenv("CWD"));
chdir("/home/jashton/dev");
printf("%s", getenv("CWD"));
}
+14 -17
View File
@@ -1,25 +1,22 @@
#!/bin/zsh #!/bin/zsh
TARGET_FILE=~/.config/xob/brightness tail -f ~/.config/xob/xobpipe | xob -s volume &
PIPE=~/.config/xob/xobpipe if [[ $# -eq 2 ]]; then
OLDNUM=`cut -f1 $TARGET_FILE` CHANGE=$1
TARGET_FILE=$2
tail -f $PIPE | xob -s brightness & elif [[ $# -eq 3 ]]; then
if [[ $# -eq 0 ]]; then CHANGE=`expr 0 - $2`
NEWNUM=`expr $OLDNUM + 5` TARGET_FILE=$3
elif [[ $# -eq 1 ]]; then else
NEWNUM=$1 echo "Improper usage. To increase a value in a file,\nupdate-bl [change] [target_file]."
elif [[ $# -eq 2 ]]; then echo "To decrease a value in a file,\nupdate-bl --decrease [change] [target_file]."
if [[ $1 -eq "--decrease" ]]; then
CHANGE=`expr 0 - $2`
elif [[ $1 -eq "--increase" ]]; then
CHANGE=$2
fi
NEWNUM=`expr $OLDNUM + $CHANGE`
fi fi
OLDNUM=`cut -f1 $TARGET_FILE`
NEWNUM=`expr $OLDNUM + $CHANGE`
if [[ $NEWNUM -le 100 && $NEWNUM -ge 0 ]]; then if [[ $NEWNUM -le 100 && $NEWNUM -ge 0 ]]; then
sed -i "s/$OLDNUM/$NEWNUM/g" $TARGET_FILE sed -i "s/$OLDNUM/$NEWNUM/g" $TARGET_FILE
brightnessctl set $NEWNUM% brightnessctl set $NEWNUM%
echo $NEWNUM >> $PIPE echo $NEWNUM >> ~/.config/xob/xobpipe
fi fi