Skip to content

Instantly share code, notes, and snippets.

View cgsdev0's full-sized avatar
🐻

sarah schulte cgsdev0

🐻
View GitHub Profile
@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`;
@cgsdev0
cgsdev0 / fizzbuzz_x-state.js
Last active July 27, 2023 07:24
fizzbuzz in x-state
// try it out here: https://codesandbox.io/s/recursing-meadow-t87lvp?file=/src/index.js
export const machine = createMachine(
{
id: "fizzbuzz",
context: {
i: "0"
},
initial: "Start",
states: {
@cgsdev0
cgsdev0 / fizzbuzz.c
Last active May 22, 2023 20:25
new fizzbuzz just dropped
#include <stdio.h>
#include <stdlib.h>
// boilerplate; ignore this part
#define loop(x) for(int _i=x;_i<=0x64;_i+=x)
#define i c+(_i-1)*012
#define pn sprintf(i,"%d\n",_i)
#define ps(s) strcpy(i,#s"\n")
#define say(s) strcmp(#s,"Number")?ps(s):pn
@cgsdev0
cgsdev0 / rolly_cubes_bot.js
Last active April 28, 2023 19:16
Rolly Cubes Bot
// Paste in your rollycubes.com console to unleash the rolly bot
let speedMult = 1;
let unsubscribe;
if (unsubscribe) unsubscribe();
let lut={22:2,23:2,24:4,25:4,26:6,27:4,28:6,29:2,30:4,32:2,34:2,36:4,37:2,38:6,
39:4,40:6,41:4,42:4,43:2,44:2,48:2,49:2,50:2,51:2,52:2,53:4,54:4,55:4,56:4,57:6,
58:8,59:10,60:10,61:10,62:8,63:6,64:4,65:2,66:2,67:2,68:2,69:4,70:6,71:8,72:10,
73:10,74:10,75:8,76:6,77:4,78:2,82:2,83:2,84:2,85:4,86:4,87:4,88:4,89:8,90:10,
91:14,92:14,93:14,94:12,95:12,96:6,97:6,98:2,99:2,100:2,101:6,102:6,103:12,104:12,
@cgsdev0
cgsdev0 / movement.cpp
Last active November 21, 2022 03:53
camera control rotation
// Takes in a movement vector and moves the cursor
static void moveHelper(ALevelEditorPawn* t, FVector v) {
if (!t->cursorLocation.Z && v.Z < 0) v.Z = 0; // Min floor
// Adjust input vector for camera rotation
AController* controller = t->GetController();
if (controller) {
FRotator rot = controller->GetControlRotation();
UE_LOG(LogTemp, Warning, TEXT("Rotation: %d"), (int)rot.Yaw);
if (rot.Yaw > 45 && rot.Yaw <= 135) {
@cgsdev0
cgsdev0 / jam_game_launcher.html
Created October 21, 2022 10:01
A simple launcher for my HTML5 jam games.
<!doctype html>
<html>
<head>
<style>
* {
margin: 0;
overflow: hidden;
}