Skip to content

Instantly share code, notes, and snippets.

View EmperorPenguin18's full-sized avatar

Sebastien MacDougall-Landry EmperorPenguin18

View GitHub Profile
@EmperorPenguin18
EmperorPenguin18 / random-type.sh
Created December 24, 2025 03:53
Morophon Creature Type Script
#!/bin/sh
# Keywords are considered "cheating" for the purposes of this script. This includes, as of writing, changeling, amass, living weapon, awaken, embalm, fabricate, eternalize, afterlife, incubate, for mirrodin!, and gift
# The query being done is an approximation, but should be 99.9% accurate
# Improvements: - Doesn't include goblin barrage or quest for the goblin lord, somehow compare number of type to number of name
# https://stackoverflow.com/questions/24656131/regex-for-existence-of-some-words-whose-order-doesnt-matter
# - Check that tiers are balanced
# - Overall testing
filename="type_log.csv" && \
ctype="$(shuf -n1 -e $(curl -s 'https://api.scryfall.com/catalog/creature-types' | jq .data[]))" && \
@EmperorPenguin18
EmperorPenguin18 / gifthumbnail.sh
Created May 11, 2021 00:36
Display an animated gif in the terminal
#!/bin/sh
VIDEO="${1:-test.mp4}"
GIF="${2:-test.gif}"
ffmpeg -ss 61.0 -t 2.5 -i "$VIDEO" -filter_complex "[0:v] fps=12,scale=w=480:h=-1,split [a][b];[a] palettegen=stats_mode=single [p];[b][p] paletteuse=new=1" "$GIF"
chafa "$GIF"
@EmperorPenguin18
EmperorPenguin18 / subscribe.sh
Created May 11, 2021 00:31
Adds my ytrefresh script to cron
#!/bin/sh
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
USER=$(ls /home)
CHANNEL="$(echo $@ | awk -F '/' '{print $NF}')"
@EmperorPenguin18
EmperorPenguin18 / ytrefresh.sh
Created May 11, 2021 00:29
Download the most recent 15 videos from a YouTube channel
#!/bin/sh
USER=$(ls /home)
mkdir -p /home/$USER/YouTube
for I in $(curl -s "https://www.youtube.com/feeds/videos.xml?channel_id=$1" | awk -F '"' '/watch/ {print $4}')
do
FORMATS=$(youtube-dl -F $I)
TITLE="$(youtube-dl --get-title $I)"
@EmperorPenguin18
EmperorPenguin18 / web_scraper.cpp
Created May 10, 2021 23:38
Get only the text from a webpage
//Code that scrapes webpages
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
string url;
@EmperorPenguin18
EmperorPenguin18 / web_scraper.c
Created May 10, 2021 23:38
Get only the text from a webpage
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define SIZE 999999
#define WORD 255
int n;
int m;
@EmperorPenguin18
EmperorPenguin18 / virus.cpp
Created May 10, 2021 23:34
Prank your friends by running this in their terminal
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <iostream>
#include <thread>
#include <chrono>
#include <fstream>
#include <time.h>
#include <unistd.h>
using namespace std;
@EmperorPenguin18
EmperorPenguin18 / raspi.cpp
Created May 10, 2021 23:31
Automate setting up a RPI
//Raspberry pi configuration
#include <iostream>
#include <string>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
string name;
@EmperorPenguin18
EmperorPenguin18 / pokedex.cpp
Created May 10, 2021 23:29
Simple Pokedex in the terminal
//Code that scrapes veekun for pokedex data and displays it to user
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
#include <time.h>
#include <ctype.h>
@EmperorPenguin18
EmperorPenguin18 / graphics.cpp
Created May 10, 2021 23:24
Create an X window
#include <X11/Xlib.h>
#include <assert.h>
#include <unistd.h>
#define NIL (0)
Display *dpy = XOpenDisplay(NIL);
assert(dpy);
int blackColor = BlackPixel(dpy, DefaultScreen(dpy));