Skip to content

Instantly share code, notes, and snippets.

@Mego
Mego / shit_mego_says.md
Created January 15, 2024 05:46
shit mego says
  1. uwu warn me harder, rustfmt
@Mego
Mego / rtcastnames.user.js
Last active April 26, 2021 21:28
Rooster Teeth Cast Names Userscript
// ==UserScript==
// @name Rooster Teeth Cast Names
// @version 1.0
// @description Adds cast names to Rooster Teeth video descriptions
// @author Mego
// @match https://roosterteeth.com/watch/*
// @icon https://roosterteeth.com/img/rt-favicon.png
// @grant none
// @homepage https://gist.github.com/Mego/50c9a6caa53658c6a305facdb67b409f
// @downloadURL https://gist.githubusercontent.com/Mego/50c9a6caa53658c6a305facdb67b409f/raw/d68000d5ba7cd9951e386de0b45835118a6809e6/rtcastnames.user.js
#!/usr/bin/env python3
import math
import random
successes = 0
history = []
n = random.randint(1, 256)
k = random.randint(1, n)
B = 0
@Mego
Mego / complex_dice.py
Last active July 24, 2017 21:19
Overly complex dice rolling for D&D
#!/usr/bin/env python3
import re
from random import randint, seed
from collections import Iterable
from functools import total_ordering
def as_list(x):
if isinstance(x, Iterable):
return list(x)
var codepages = {"cp1257": ["\u0000", "\u0001", "\u0002", "\u0003", "\u0004", "\u0005", "\u0006", "\u0007", "\b", "\t", "\n", "\u000b", "\f", "\r", "\u000e", "\u000f", "\u0010", "\u0011", "\u0012", "\u0013", "\u0014", "\u0015", "\u0016", "\u0017", "\u0018", "\u0019", "\u001a", "\u001b", "\u001c", "\u001d", "\u001e", "\u001f", " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "\u007f", "\u20ac", "", "\u201a", "", "\u201e", "\u2026", "\u2020", "\u2021", "", "\u2030", "", "\u2039", "", "\u00a8", "\u02c7", "\u00b8", "", "\u2018", "\u2019", "\u201c", "\u201d", "\u2022", "\u2013", "\u2014", "", "
MThd   àMTrk  ÿY ÿX ÿQÅ ÿ/ MTrk ò À ÿPiano Q_X€Q N_l€N O_l€O Q_X€Q N_l€N O_l€O Q_l€Q E_l€E G_l€G I_l€I J_l€J L_l€L N_l€N O_l€O N_X€N J_l€J L_l€L N_X€N B_l€B C_l€C E_l€E G_l€G E_l€E C_l€C E_l€E B_l€B C_l€C E_l€E C_X€C G_l€G E_l€E C_X€C B_l€B @_l€@ B_l€B @_l€@ >_l€> @_l€@ B_l€B C_l€C E_l€E G_l€G C_X€C G_l€G E_l€E G_X€G I_l€I J_l€J I_l€I E_l€E G_l€G I_l€I J_l€J L_l€L N_l€N O_l€O J_ N_ Q_ŽL€J €N €Q ƒ`ÿ/
#!/usr/bin/env python3
bits_to_symbols = {
0b000: '<',
0b001: '>',
0b010: '[',
0b011: ']',
0b100: '+',
0b101: '-',
0b110: ',',
#!/usr/bin/env python
def pack(s):
binary_string = ''
for c in s:
binary_string += '{:07b}'.format(ord(c))
binary_string += '0'*((8 - len(binary_string)) % 8)
byte_string = ''
for i in range(0, len(binary_string), 8):
byte_string += chr(int(binary_string[i:i+8], 2))
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
std::stringstream prog;
constexpr unsigned c_strlen( char const* str, unsigned count = 0 )
{
return ('\0' == str[0]) ? count : c_strlen(str+1, count+1);