Skip to content

Instantly share code, notes, and snippets.

View cgsdev0's full-sized avatar
🐻

sarah schulte cgsdev0

🐻
View GitHub Profile
@cgsdev0
cgsdev0 / minecraft_skin_exploder.html
Created March 16, 2022 03:39
slices a minecraft skin into multiple images; currently hosted here https://cgs.dev/minecraft_skin_exploder.html
<!doctype html>
<html>
<head>
<title>Minecraft Skin Exploder</title>
</head>
<script type="text/javascript">
const maskdata = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAZhJREFUeJztm71KA0EURjPaiJAmgitiYbWY3iewsNQm2FjZiZBewVLQUhDFTgR/QFL5HBaCxYattNIFkyYidmstCXcIN3DA/U6dO3P4uLOZ2UlCLcLC4VwZ+4zFx1EveOrLi6Zr/rCXmfNPeQb/DygAWoBGAdACNAqAFqAJ3u95L++L8+T06gAFQAvQKABagEYB0AI0Q2fl9Kww9wV5OzHP143VLde+ov/0YI5frKTm+Ek3H+v9Q+U7QAHQAjQhtuZjfF63J+Uykuzr2VUfeyZUvgMUAC1AowBoARoFQAvQKABagEYB0AI0Q/vkRr1lng36g465ty6bP777/GzGHP929socf/t7R+8DxkEB0AI0IbbmY/SWbiblMpK7t3tXfeyZUPkOUAC0AI0CoAVoFAAtQKMAaAEaBUAL0Aztk+utDfNsMOg8mnvr18K+v19O7Lu6tLD/H5An9u//dw/2zfrL45M/9ZXvAAVAC9CE2JqP8XLedQms16Zd9Wunm676yneAAqAFaBQALUCjAGgBGgVAC9AoAFqA5heamUiO3GpTvwAAAABJRU5ErkJggg==";
const old_colormap = {
"left_arm": "#e92826",
@cgsdev0
cgsdev0 / twitch_chat.sh
Created January 26, 2022 09:30
Display live twitch chat directly in your terminal
#!/bin/zsh
# depends on 'websocat' https://github.com/vi/websocat
#
# twitch_chat {channel} - opens a websocket for reading chat
twitch_chat () {
rm -f /tmp/twitch_tunnel;
mkfifo /tmp/twitch_tunnel;
clear;
@cgsdev0
cgsdev0 / kenken.cpp
Created March 29, 2020 06:26
(C++) KenKen Puzzle Solver
/*
Program that solves a kenken puzzle and pretty prints the result.
Reading the puzzle as input is not currently supported.
*/
#include <fcntl.h>
#include <locale.h>
#include <iomanip>
#include <iostream>
#include <locale>
@cgsdev0
cgsdev0 / zsh_web_server.md
Last active March 18, 2020 20:28
ZSH Web Server

ZSH Web Server

Have you ever used the command python -m http.server and thought hmm... I really wish this didn't require such a heavy depedency like Python?

Well, now you can accomplish the same goal from the comfort of ZSH! Simply add this line to your zsrhc, then type serve in the folder you'd like to start a HTTP server for.

serve () { rm /tmp/tunnel; mkfifo /tmp/tunnel; echo "Serving $(pwd) on 127.0.0.1:8000..."; while true; do (printf "HTTP/1.0 200 OK\n"; (reqreader() { while IFS= read line;  do [[ $line = $'\r' ]] && break; echo "$line"; done; exit 0; }; var=$(</tmp/tunnel | reqreader); var=$(echo "$var" | grep ^GET | sed 's/GET \(.*\) HTTP\/1\.1.*/\1/'); var=$(echo "$var" | sed 's/^\(.*\)@$/\1/' | sed 's/^\(.*\)\*/\1/'); var=$(echo "<!doctype html><html><head><title>$(pwd)</title></head><body>"; (cat "./$var" 2> /dev/null || (ls -F "./$var" 2> /dev/null | sed 's/\(.*\)/<a href="\1">\1<\/a><br \/>/')); echo "</body></html>"); printf "Content-Length: "; echo "$var" | wc -c; printf "\r\n
@cgsdev0
cgsdev0 / decToInt.cpp
Created May 12, 2019 02:38
Round argv[1] to the nearest integer
/*
This program rounds argv[1] to the nearest integer.
It was tasked as a college programming assignment to one of my friends,
and written by me (in this horrifying way so he couldn't steal it and
turn it in)
*/
#include <iostream>
@cgsdev0
cgsdev0 / fizzbuzz.cpp
Last active January 26, 2024 14:28
FizzBuzz State Machine (C++)
/*
(Dumb) idea to implement the classic FizzBuzz
problem as a state machine with 16 states.
*/
#include <iostream>
#include <vector>
#include <functional>
#include <stdlib.h>