Last active
July 1, 2024 12:45
-
-
Save bokwoon95/9ac84beb08d5769e09b4e3b102e5f16c to your computer and use it in GitHub Desktop.
Revisions
-
bokwoon95 revised this gist
Jul 1, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/usr/bin/env bash sudo apt-get update -y sudo apt-get install -y git tmux libvips libvips-tools sqlite3 sudo apt-get upgrade -y curl --location --output go.tgz "https://dl.google.com/go/$(curl https://go.dev/dl/?mode=json | grep -o '"version": "go.*"' | head -n 1 | xargs | cut -d ' ' -f 2).linux-$(dpkg --print-architecture).tar.gz" sudo tar -xzf go.tgz --directory /usr/local -
bokwoon95 revised this gist
Jul 1, 2024 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,9 +5,9 @@ sudo apt-get upgrade -y curl --location --output go.tgz "https://dl.google.com/go/$(curl https://go.dev/dl/?mode=json | grep -o '"version": "go.*"' | head -n 1 | xargs | cut -d ' ' -f 2).linux-$(dpkg --print-architecture).tar.gz" sudo tar -xzf go.tgz --directory /usr/local rm go.tgz sudo ln -sf /usr/local/go/bin/go /usr/local/bin/go sudo ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt sudo ln -sf "$HOME/go/bin/notebrew" /usr/local/bin/notebrew if ! test -e "$HOME/nb10"; then pushd "$HOME" git clone https://github.com/bokwoon95/nb10 -
bokwoon95 revised this gist
Jul 1, 2024 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,9 +5,9 @@ sudo apt-get upgrade -y curl --location --output go.tgz "https://dl.google.com/go/$(curl https://go.dev/dl/?mode=json | grep -o '"version": "go.*"' | head -n 1 | xargs | cut -d ' ' -f 2).linux-$(dpkg --print-architecture).tar.gz" sudo tar -xzf go.tgz --directory /usr/local rm go.tgz sudo ln -s /usr/local/go/bin/go /usr/local/bin/go sudo ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt sudo ln -s "$HOME/go/bin/notebrew" /usr/local/bin/notebrew if ! test -e "$HOME/nb10"; then pushd "$HOME" git clone https://github.com/bokwoon95/nb10 @@ -52,4 +52,5 @@ else vips resize "$INPUT_PATH" "$OUTPUT_PATH" "$scale_factor" echo "$INPUT_PATH: width = $width, old height = $height" echo "$OUTPUT_PATH: width = $(vipsheader "$OUTPUT_PATH" -f width), height = $(vipsheader "$OUTPUT_PATH" -f height)" fi' | sudo tee /usr/local/bin/imgresize > /dev/null sudo chmod +x /usr/local/bin/imgresize -
bokwoon95 revised this gist
Jul 1, 2024 . 1 changed file with 37 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,4 +16,40 @@ else pushd "$HOME/nb10" git pull popd fi echo '#!/usr/bin/env bash set -e set -u set -o pipefail INPUT_PATH="$1" OUTPUT_PATH="$2" if test ! -f "$INPUT_PATH"; then echo "INPUT_PATH $INPUT_PATH does not exist" exit 1 fi width="$(vipsheader "$INPUT_PATH" -f width)" height="$(vipsheader "$INPUT_PATH" -f height)" scale_factor="$(awk -v "width=$width" -v "height=$height" "BEGIN { aspect_ratio = width / height; is_tall_img = aspect_ratio < 9 / 16; if (is_tall_img || width > height) { if (width <= 1080) { print 1; } else { print 1080 / width; } } else { if (height <= 1080) { print 1; } else { print 1080 / height; } } }")" if test "$scale_factor" = "1"; then mv "$INPUT_PATH" "$OUTPUT_PATH" else vips resize "$INPUT_PATH" "$OUTPUT_PATH" "$scale_factor" echo "$INPUT_PATH: width = $width, old height = $height" echo "$OUTPUT_PATH: width = $(vipsheader "$OUTPUT_PATH" -f width), height = $(vipsheader "$OUTPUT_PATH" -f height)" fi' -
bokwoon95 revised this gist
Jul 1, 2024 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ #!/usr/bin/env bash sudo apt-get update -y sudo apt-get install -y git tmux libvips libvips-tools sudo apt-get upgrade -y curl --location --output go.tgz "https://dl.google.com/go/$(curl https://go.dev/dl/?mode=json | grep -o '"version": "go.*"' | head -n 1 | xargs | cut -d ' ' -f 2).linux-$(dpkg --print-architecture).tar.gz" sudo tar -xzf go.tgz --directory /usr/local -
bokwoon95 revised this gist
Jul 1, 2024 . 1 changed file with 18 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,18 @@ sudo apt-get update -y sudo apt-get install -y git tmux sudo apt-get upgrade -y curl --location --output go.tgz "https://dl.google.com/go/$(curl https://go.dev/dl/?mode=json | grep -o '"version": "go.*"' | head -n 1 | xargs | cut -d ' ' -f 2).linux-$(dpkg --print-architecture).tar.gz" sudo tar -xzf go.tgz --directory /usr/local rm go.tgz ln -s /usr/local/go/bin/go /usr/local/bin/go ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt ln -s "$HOME/go/bin/notebrew" /usr/local/bin/notebrew if ! test -e "$HOME/nb10"; then pushd "$HOME" git clone https://github.com/bokwoon95/nb10 popd else pushd "$HOME/nb10" git pull popd fi -
bokwoon95 revised this gist
Jun 30, 2024 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ # Replace linux-amd64 with linux-arm64 if using an ARM server. curl --location --output go.tgz "https://dl.google.com/go/$(curl https://go.dev/dl/?mode=json | grep -o '"version": "go.*"' | head -n 1 | xargs | cut -d ' ' -f 2).linux-amd64.tar.gz" tar -xzf go.tgz --directory /usr/local ln -s /usr/local/go/bin/go /usr/local/bin/go ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt # TODO: untar go.tgz into $GOROOT (/usr/local/go) # TODO: symlink the go binaries in /usr/local/go/bin into /usr/local/bin -
bokwoon95 created this gist
May 8, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ # Replace linux-amd64 with linux-arm64 if using an ARM server. curl --location --output go.tgz "https://dl.google.com/go/$(curl https://go.dev/dl/?mode=json | grep -o '"version": "go.*"' | head -n 1 | xargs | cut -d ' ' -f 2).linux-amd64.tar.gz" # TODO: untar go.tgz into $GOROOT (/usr/local/go) # TODO: symlink the go binaries in /usr/local/go/bin into /usr/local/bin