Skip to content

Instantly share code, notes, and snippets.

@Rhomboid
Rhomboid / index.html
Created January 6, 2015 08:08
Internet Archive MS DOS games index
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Internet Archive MS-DOS Games</title>
<style>li { list-style-type: none; margin-bottom: 1em }</style>
</head>
<body>
<ul>
<li><a href="https://archive.org/details/msdos_Nam_1965-1975_1991">'Nam 1965-1975 (1991)</a><br>
@Rhomboid
Rhomboid / bench.py
Last active August 29, 2015 14:08
Python JSON module benchmark (3.x)
from random import randint, random, choice, uniform, seed
from string import ascii_letters
from timeit import repeat
import json
def rand_string():
return ''.join(choice(ascii_letters) for _ in range(randint(3, 24)))
def make_test_data(depth=0):
if random() > 1 - (depth / 9)**3:
@Rhomboid
Rhomboid / source.c
Last active August 29, 2015 14:07
Scaling 0-255 to 0.00-5.00 for a microcontroller with only 8 bit operations
#include <stdio.h>
#include <string.h>
static const unsigned char lookup[][5] = { { 0, 0, 1, 9, 6 },
{ 0, 0, 3, 9, 2 },
{ 0, 0, 7, 8, 4 },
{ 0, 1, 5, 6, 9 },
{ 0, 3, 1, 3, 7 },
{ 0, 6, 2, 7, 5 },
{ 1, 2, 5, 4, 9 },
@Rhomboid
Rhomboid / gist:fcd11a01934a34365c7b
Created August 26, 2014 13:28
identifiers used in the C++11 standard library
__alignas_is_defined
__bool_true_false_are_defined
_1
_Exit
abort
abs
accumulate
acos
acosh
address
@Rhomboid
Rhomboid / func.cpp
Created August 16, 2014 20:44
ODR and inlining demonstration
#include "func.hpp"
void (*func_ref_func)(void) = &func;
void hidden() {
// stuff
}
@Rhomboid
Rhomboid / memaccess.cpp
Created July 25, 2014 05:39
Memory access - sequential vs. random
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <chrono>
#include <random>
#include <limits>
int main()
{
@Rhomboid
Rhomboid / commands.sh
Created July 15, 2014 11:45
Download Weird Al's Tacky with rtmpdump
rtmpdump -o weirdal_tacky.flv -r rtmpe://fms.413C.edgecastcdn.net/00413C/content/ -y 'mp4:conversions/bzmbq0FD/videos/udcyXmsG-3208411.mp4?eee6cc8084bc02b3096443468bd6269a25236a7cc572265bd247c2deec86cc78281f8efc5c11f24dcf4870bc3d93ce2fd5eb2b45776315b6885e4e4f7ce40d249661772ad7f52e90cd98aa89cf5caf5ccd009ea054b841d3938839543b4a455dec905139d42bc43c63ca3340dc6f9209'
# if it doesn't work, fetch http://content.nerdist.com/manifests/udcyXmsG.smil and get the parameters from there
@Rhomboid
Rhomboid / bubblesort_lambda.cpp
Last active August 29, 2015 14:03
bubble sort with lambda
#include <vector>
#include <string>
#include <random>
#include <iterator>
#include <iostream>
#include <algorithm>
template<typename T, typename Eng>
std::vector<T> make_random_ints(size_t n, Eng eng, T min, T max)
{
@Rhomboid
Rhomboid / scrape_webadvisor.py
Created June 28, 2014 23:09
WebAdvisor scraping example
import requests
from bs4 import BeautifulSoup
from itertools import chain
baseurl = 'https://webadv.sunyrockland.edu/WebAdvisor/WebAdvisor'
main_page = {'type': 'M', 'pid': 'CORE-WBMAIN'}
section_search = {'CONSTITUENCY': 'WBAP', 'type': 'P', 'pid': 'ST-WESTS12A'}
s = requests.Session()
s.params = {'TOKENIDX': ''}
@Rhomboid
Rhomboid / ver1.c
Last active March 23, 2023 00:06
Obfuscated C code (Twelve days of Christmas)
#include <stdio.h>
main(t,_,a)
char *a;
{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a
)&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,
t,"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\
,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/\
+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){n\