Skip to content

Instantly share code, notes, and snippets.

@llimllib
llimllib / padcolors.py
Last active Feb 24, 2021
Setting pad colors on the Novation LaunchKey Mini MK3
View padcolors.py
# This file demonstrates how to use midi codes to control the color of the
# keypads on a Novation LaunchKey mini; There is no official documentation of
# it as far as I can tell
#
# the LaunchKey MK2 Programmer's guide is useful, though not accurate to
# details on the MK3 mini:
# https://customer.novationmusic.com/sites/customer/files/novation/downloads/10535/launchkey-mk2-programmers-reference-guide.pdf
import random
import time
View main.go
package main
import (
"fmt"
"html/template"
"log"
"net/http"
"os"
)
View main.go
package main
// An extremely simple web application skeleton
import (
"fmt"
"log"
"net/http"
"os"
)
@llimllib
llimllib / hamming.md
Created Dec 28, 2020
One Man's View of Computer Science
View hamming.md

Richard W. Hamming

January 1969

One Man's View of Computer Science

Abstract

A number of observations and comments are directed toward suggesting that more than the usual engineering flavor be given to computer science. The engineering

View notebook
#!/usr/bin/env bash
# assume that if an `nb` dir (presumably a virtualenv) exists, then we don't
# need to do any of the time-consuming stuff
if [ ! -d nb ]; then
python -mvenv nb
# # ipykernel is required for bash_kernel \
nb/bin/pip install \
bash_kernel \
ipykernel \
@llimllib
llimllib / render_shapefile.bash
Last active Nov 18, 2020
Render a shapefile to a png and display it in your terminal, in one command
View render_shapefile.bash
# make a temporary directory and push it on to the stack
tmp=$(mktemp -d); pushd $tmp && \
# get a US map at 20m resolution and unzip it
curl -s https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_region_20m.zip -o us.zip && \
unzip -q us.zip && \
# rasterize the map's only layer, using the `ALAND` feature. Restrict the
# bounding box (-te) to the continental US, because the map includes Alaska
# and Hawaii and Guam, and we're not going to bother with those here
# (sorry!). -ts sets the output size to 1200x800, then we give the input and
# output files.
@llimllib
llimllib / mssql_to_csv.bash
Last active Oct 14, 2020
This is a script to convert every table in a Microsoft SQL Server database backup (.bak file) to a .csv file
View mssql_to_csv.bash
#!/usr/bin/env bash
# import an MS SQL .bak backup file to an MS SQL database, then export all
# tables to csv. run this script as `import.sh <filename>`. It expects to be
# run in the same directory as the backup file.
# this is only tested on my mac (OS X Catalina). I tried to stick to posix, but
# It will probably require some tweaking for you. I hope it gives a general
# sense of what you need to do at the very least.
View a.py
import pyglet
class AWindow(pyglet.window.Window):
def __init__(self):
super(AWindow, self).__init__(100, 100)
self.batch = pyglet.graphics.Batch()
self.circle = pyglet.shapes.Circle(
View a.py
import pyglet
class AWindow(pyglet.window.Window):
def __init__(self):
super(AWindow, self).__init__(100, 100)
self.batch = pyglet.graphics.Batch()
self.circle = pyglet.shapes.Circle(
View a.py
import pyglet
window = pyglet.window.Window()
batch = pyglet.graphics.Batch()
label = pyglet.text.Label(
"Hello, world",
font_name="Times New Roman",
font_size=36,
x=window.width // 2,
y=window.height // 2,