Skip to content

Instantly share code, notes, and snippets.

View scruss's full-sized avatar
💭
🦆

Stewart Russell scruss

💭
🦆
View GitHub Profile
@scruss
scruss / hp7470a.py
Created February 21, 2014 20:20
Approximation of a HP7470a driver for Chiplotle
"""
* This file is part of chiplotle.
*
* http://music.columbia.edu/cmc/chiplotle
*
* HP7470A class contributed by scruss - 2014-02-21
"""
from chiplotle.plotters.drawingplotter import _DrawingPlotter
@scruss
scruss / hpgl-shapely_hatch.py
Created April 15, 2014 02:53
hpgl-shapely_hatch - simple Shapely/HP-GL hatching function demo
#!/usr/bin/python
# -*- coding: utf-8 -*-
# hpgl-shapely_hatch - simple Shapely/HP-GL hatching function demo
# scruss — 2014-04-14 — WTFPL (srsly)
from shapely.geometry import box, MultiLineString, Point, LineString
from shapely.affinity import rotate, scale
from shapely import speedups
from math import sqrt
@scruss
scruss / selfie.sh
Created June 24, 2014 00:53
selfie simulator simulator ...
#!/bin/bash
# strongly influenced by Interstellar Selfie Simulator
# scruss - 2014-06-23
anytopnm "$1" |\
pnmscale -xsize 160 |\
pnmhisteq |\
ppmdither -red 4 -green 4 -blue 4 |\
ppmtopgm |\
pnmremap -mapfile <(echo P3 4 1 255 108 108 78 142 139 97 195 196 165 227 230 201) |\
@scruss
scruss / esc-pos-image.py
Last active March 25, 2024 21:29
print image files to thermal printer ESC-POS on stdout
#!/usr/bin/env python3
# esc-pos-image.py - print image files given as command line arguments
# to simple ESC-POS image on stdout
# scruss - 2014-07-26 - WTFPL (srsly)
# - 2021-01-09 (made python3 compatible - tvm Carko!)
# if you want a proper CUPS driver for a 58mm thermal printer
# that uses this command set, go here:
# https://github.com/klirichek/zj-58
@scruss
scruss / esc-pos-image-star.py
Created July 27, 2014 03:14
print image files to thermal printer ESC-POS on stdout, using ESC * instead of GS v
#!/usr/bin/python
# esc-pos-image-star.py - print image files given as command line arguments
# to simple ESC-POS image on stdout
# using ESC * \x21
# scruss - 2014-07-26 - WTFPL (srsly)
import sys
from PIL import Image
import PIL.ImageOps
import struct
@scruss
scruss / keybase.md
Created September 18, 2014 04:35
keybase.md

Keybase proof

I hereby claim:

  • I am scruss on github.
  • I am scruss (https://keybase.io/scruss) on keybase.
  • I have a public key whose fingerprint is 2DED C39B A8DB 30AB EA61 4AFE 0DA7 7A09 56EA 3459

To claim this, I am signing this object:

@scruss
scruss / scarboro_neighbs.geojson
Created October 25, 2014 15:02
overpass export of scarboro neighbourhoods
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Verifying that +scruss is my blockchain ID. https://onename.com/scruss
@scruss
scruss / mandlsm.f
Created June 22, 2016 01:10
a sample Fortran-77 program that produces a greyscale Mandelbrot set in PGM format to stdout
program mandlsm
*
*
*
implicit none
integer nx,ny,maxiter,ix,iy,mslsm,j
parameter (nx=512,ny=512,maxiter=256)
external mslsm
integer mset(nx,ny)
real cx,cy,xmin,xmax,ymin,ymax
@scruss
scruss / OttawaBFOMapData.md
Last active October 23, 2016 01:26
Ottawa 2000 Scale data mapping notes