Skip to content

Instantly share code, notes, and snippets.

View porglezomp's full-sized avatar
💖
GITHUB DROP ICE

Cassie Jones porglezomp

💖
GITHUB DROP ICE
View GitHub Profile
(let! *width* 128)
(let! *height* 128)
(struct cplx
real imag)
(let! real cplx/real)
(let! imag cplx/imag)
(defn (c/+ a b)
<html>
<head>
<meta charset="utf8"/>
<title>Driver Station</title>
</head>
<body>
<img src="http://10.10.76.17:5807/?action=stream" width="480" height="360" class="flip"/>
<img src="http://10.10.76.19:5809/?action=stream" width="480" height="360" class="flip"/>
<style>.flip { transform: rotate(180deg); }</style>
</body>
@porglezomp
porglezomp / philosophers.c
Created March 19, 2017 17:51
Socrates and Plato sit down for dinner
/* Compile as gcc philosophers.c -pthread */
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
pthread_mutex_t fork_ = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t knife = PTHREAD_MUTEX_INITIALIZER;
void *socrates(void *nothing) {
User Kanye Anime Comment
SufjanStevens Late Registration good
joaquin 808s bad
pedroteixeira MBDTF good
Tahloolah MBDTF good
ligeti MBDTF N/A Q2) My Beautiful Dark Twisted Fantasy
Ziven001 Yeezus good
CrimeFuck College Dropout good
shaded_fox Late Registration good
Cian 808s good
@porglezomp
porglezomp / bfmemo.py
Last active August 25, 2017 05:44
BF Trees
import itertools
import time
COUNTS_SUMMING = {0: [[]]}
def counts_summing(n):
if n not in COUNTS_SUMMING:
sums = []
for first in range(1, n+1):
for rest in counts_summing(n - first):
sums.append([first] + rest)
@porglezomp
porglezomp / bytecode
Last active October 24, 2017 16:07
python bytecode
def fib(n):
a, b = 0, 1
for _ in range(n):
a, b = b, a + b
return a
Then, using dis.dis(fib)
CPython bytecode:
2 0 LOAD_CONST 3 ((0, 1))
@porglezomp
porglezomp / table.py
Created November 2, 2017 05:54
Python DB-Table Ish Thing
from collections import defaultdict
class Table:
def __init__(self):
self.items = []
self.indices = {}
@staticmethod
def _get_key(item, key):
@porglezomp
porglezomp / codl-pep.rst
Last active January 10, 2021 01:58
codl pep

PEP: 9999 Title: Add Lab to colorsys Author: Cassie Jones <code@witchoflight> codl Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 28-Nov-2017 Python-Version: 3.7 Post-History: 30-Aug-2002

@porglezomp
porglezomp / 01-tasks
Last active December 9, 2017 06:23
the great and terrible macro DSL
// this is the embedded DSL
tasks! {
heap h;
task {
loop {
wait for AbsDiff(1, 2);
[3] = h[&1] - h[&2];
if (h[&3] > 0) {
@porglezomp
porglezomp / audio2jpeg.sh
Last active December 19, 2017 22:40
All Star but it's been transcoded through a 0% quality JPEG
#!/bin/sh
set -ex
ffmpeg -y -i "$1" -f u8 -ac 1 all-star.pcm
size=`wc -c all-star.pcm | tr -s ' ' | cut -d' ' -f2`
size=`python3 -c "M = $size//3; N=int(M**0.5); print(f'{N}x{M//N}')"`
convert -size "$size" -depth 8 rgb:all-star.pcm -quality 0% "$2"