Skip to content

Instantly share code, notes, and snippets.

View paultag's full-sized avatar

Paul Tagliamonte paultag

View GitHub Profile
DEF_NAME print
DEF_CONST omgfst "omgfast"
DEF_LABEL hi
LOAD_GLOBAL print
LOAD_CONST omgfst
CALL_FUNCTION 1
POP_TOP
JUMP_ABSOLUTE hi
@paultag
paultag / doto.hy
Created October 8, 2014 00:34
doto
#!/usr/bin/env hy3
;;; doto.hy - do something to a bunch of other things.
;;; Copyright (c) Paul R. Tagliamonte, MIT/Expat, 2014.
;;;
(import
os sys subprocess
[concurrent.futures [ThreadPoolExecutor]]
[itertools [groupby]]
@paultag
paultag / mro.py
Created October 15, 2014 00:12
mro
from collections import ChainMap
class Bar(object):
y = 1
class Foo(Bar):
a = 1
b = 2
>>> import dis
>>> def x():
... print(True)
...
>>> dis.dis(x)
2 0 LOAD_GLOBAL 0 (True)
3 PRINT_ITEM
4 PRINT_NEWLINE
5 LOAD_CONST 0 (None)
8 RETURN_VALUE
#!/usr/bin/env python
from opencv.cv import *
from opencv.highgui import *
cvNamedWindow("w1", CV_WINDOW_AUTOSIZE)
capture = cvCreateCameraCapture(0)
def calculate( image ):
greyscale = cvCreateImage(cvSize(image.width, image.height), 8, 1)
/*
* "Throb" effect.
*
* Paul Tagliamonte, 2010.
*
* This is a re-take on the classic "pulse" ( otherwise
* known as the standby, throb, blob, mob or rob effect )
*
* Yes, that was a joke. Lighten up, this is programming.
*
@paultag
paultag / rgb_throb.this.is.not.c
Created October 31, 2010 22:41
The RGB Throbber
/*
* "Throb" effect ( Part Deux )
*
* Paul Tagliamonte, 2010. ( Peace, Love and C++, baby )
*
* This code is released under the Bacon license.
* If you like this code enough, consider sending me bacon.
*
* That or GPL-3+.
*
@paultag
paultag / gol.c
Created February 22, 2011 06:07
Goofy Game of Life impl
#include <iostream>
#include <limits.h>
#include <math.h>
using namespace std;
int WORLD = 0;
int LASTWORLD = 0;
int NEWWORLD = 0;
@paultag
paultag / huzzah!
Created August 22, 2011 15:29
tarball generator
#!/bin/bash
BUILD_DIR=/var/builds
GNUPG_KEY=DBC1F58D
MIRRORDIR=/git/
WORKDIR=/tmp/$$.d/
echo "Creating workdir: $WORKDIR"
mkdir $WORKDIR
@paultag
paultag / gist:1313020
Created October 25, 2011 14:55
clear the screen in c++
#include <iostream>
using namespace std;
int main ( int argc, char ** argv ) {
char msg[] = {
0x1B, '[', '2', 'J', 0x1B, '[', 'H', '\0'
};
std::cout << msg;
}