Skip to content

Instantly share code, notes, and snippets.

View cgsdev0's full-sized avatar
🐻

cgsdev0

🐻
View GitHub Profile
Chain Link by mrzombieuk [CC-BY] (https://creativecommons.org/licenses/by/3.0/) via Poly Pizza (https://poly.pizza/m/U8MTqEf3dq)
https://freesound.org/people/150128/sounds/326682/
https://opengameart.org/content/modular-rpg-characters
clipboard by William Murphy [CC-BY] (https://creativecommons.org/licenses/by/3.0/) via Poly Pizza (https://poly.pizza/m/8H5SDxwMnEA)
https://toppng.com/free-image/black-dragon-icon-dragon-icon-PNG-free-PNG-Images_125708
Ethereal Pasture by DanJohansen [CC-BY] (https://creativecommons.org/licenses/by/3.0/) https://www.newgrounds.com/audio/listen/1007740
pgorley
iraddev - pgorley friend
Wet Floor Sign by J-Toastie [CC-BY] (https://creativecommons.org/licenses/by/3.0/) via Poly Pizza (https://poly.pizza/m/it0AE63TMj)
Time Hotel 5.27 Paper Clip by S. Paul Michael [CC-BY] (https://creativecommons.org/licenses/by/3.0/) via Poly Pizza (https://poly.pizza/m/cV4stkoel1z)
@cgsdev0
cgsdev0 / stupid_dino_game.bash
Last active April 24, 2025 12:43
i hope you're happy
#!/usr/bin/env bash
wx=24
wy=9
px=18
py=4
cy=4
cx=1
#!/bin/bash
function quote_args() {
SPACER=
while [[ $# -gt 0 ]]; do
printf "%s\"%s\"" "$SPACER" "${1//\"/\\\"}"
shift
SPACER=' '
done
}
#!/bin/bash
popup() {
TMP="$(mktemp)"
trap "rm $TMP" EXIT
cat > "$TMP"
tmux display-popup -w $WIDTH -h $HEIGHT $* "cat \"$TMP\" | termsand"
}
PANE=$(tmux display -p "#{pane_id}")
@cgsdev0
cgsdev0 / k-smallest-pairs.bash
Created July 23, 2024 07:15
k smallest pairs
#!/bin/bash
ARR1=(1 2 3 4 5)
ARR2=(2 3 4 5 6)
K=5
declare -a priority_queue
@cgsdev0
cgsdev0 / command.sh
Created March 11, 2024 01:56
uploadthing speedrun
APP_NAME="bash"; COOKIE_STR="$(cat ~/.uploadthingcookie)"; \
JWT="$(curl -Ss \
'https://clerk.uploadthing.com/v1/client/sessions/sess_2dW3vhIqxSNMjfSOZnFoDgWHYfZ/tokens?_clerk_js_version=4.70.3' \
-X 'POST' \
-H 'authority: clerk.uploadthing.com' \
-H 'accept: */*' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'content-length: 0' \
-H 'content-type: application/x-www-form-urlencoded' \
-H "$COOKIE_STR" \
@cgsdev0
cgsdev0 / house_builder.sh
Created February 3, 2024 16:07
house builder pattern in bash
#!/usr/bin/env bash
function house_builder() {
# floors,rooms,has_garage
echo "0,0,0"
}
function set_field() {
local f r g
IFS=, read f r g
@cgsdev0
cgsdev0 / index.sh
Created December 29, 2023 03:50
htmx.trigger test
htmx_page <<-EOF
<script>
window.addEventListener("DOMContentLoaded", () => {
htmx.trigger("#thing", "myEvent", {answer : 42});
});
</script>
<div id="thing" hx-trigger="myEvent" hx-post="/test"></div>
EOF
@cgsdev0
cgsdev0 / ld54.sh
Created October 4, 2023 13:42
LD54 analysis tools
#!/bin/bash
cd /var/lib/docker/volumes/root_ld54volume/_data
list_scores() {
for LEVEL in {0..14}; do
SCORE_AND_USER=$(sort $LEVEL -n | head -1)
SCORE=$(echo "$SCORE_AND_USER" | cut -d' ' -f1)
USER=$(echo "$SCORE_AND_USER" | cut -d' ' -f2)
FREQ=$(sort -u "$LEVEL" | grep -c '^'"$SCORE ")
@cgsdev0
cgsdev0 / twitch_oauth.js
Created August 19, 2023 10:59
twitch identity provider flow
///////////////////////////
// Client
///////////////////////////
// when the user clicks the 'login with twitch' button...
document.location =
`https://id.twitch.tv/oauth2/authorize` +
`?client_id=${TWITCH_CLIENT_ID}` +
`&redirect_uri=${redirect}` +
`&response_type=token`;