Skip to content

Instantly share code, notes, and snippets.

@wware
wware / widget010.scad
Last active June 15, 2019 20:45
3d-printable widget for Veracode's new "010" logo
$fn = 120;
thickness = 8;
height = 12;
width = 2;
module zero() {
difference() {
translate([0, 0, -.5*thickness])
cylinder(h=thickness, d=height);
translate([0, 0, -.5*thickness-1])
@wware
wware / commands.py
Last active December 23, 2025 02:06
A little command infrastructure thing to simplify using argparse.
import argparse
import logging
import os
import pdb
import re
import subprocess
_cmds = {}
_args = []
@wware
wware / git_ancestors.py
Last active April 18, 2019 20:05
A breadth-first-search decorator to search the history of a git repository to find the most recent commit(s) satisfying some criterion.
import os
from functools import wraps
def cmd(x):
return os.popen(x).read().strip()
def predecessors(hash):
return cmd("git log --pretty=%P -n 1 {0}".format(hash)).split(" ")
def is_a_merge_commit(hash):
@wware
wware / 1_kubernetes_on_macOS.md
Last active February 15, 2019 22:19 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

"""
There is an unfortunate thing about Python scoping. You can't easily access the variables
of a calling function (as you can do in Scheme) so if you want to use those variables you
need to jump thru silly hoops. See
https://stackoverflow.com/questions/15608987/access-variables-of-caller-function-in-python
The nice thing about using a caller's variables is that it provides a nice way to do closures.
Variable access in closures will work OK as long as you are not ASSIGNING the variable. In
this case, we assign indices of "scope" but we never assign scope itself -- if we did, Python
would conclude that scope belongs to stuff, not to make_thing. Annoying.
@wware
wware / using_git-svn.md
Last active November 29, 2018 21:08 — forked from rickyah/using_git-svn.md
A simple guide to git-svn

Getting started with git-svn

git-svn is a git command that allows using git to interact with Subversion repositories.git-svn is part of git, meaning that is NOT a plugin but actually bundled with your git installation. SourceTree also happens to support this command so you can use it with your usual workflow.

Reference: http://git-scm.com/book/en/v1/Git-and-Other-Systems-Git-and-Subversion

Cloning the SVN repository

You need to create a new local copy of the repository with the command

@wware
wware / goldbach.py
Last active November 28, 2018 14:30
"""
https://twitter.com/fermatslibrary/status/1067423316095508480
Today's paper is a good example of an unsolved conjecture being disproved by counterexample.
Goldbach stated that every positive odd integer is either prime or the sum of a prime and
twice a square. 5777 and 5993 are the only known counterexamples.
https://fermatslibrary.com/s/a-not-so-famous-goldbach-conjecture#email-newsletter
"""
# this is python 2, not python3

Can you put LaTeX-style math in a Github Gist? Yes you can.

Use https://www.codecogs.com/eqnedit.php to edit your math. Use the little menu at the bottom to select "HTML (Edit)", and copy the stuff into your Gist. Here is a fairly meaningless example.

Clicking on this will allow your reader to review and edit the source.

@wware
wware / 0_Instrument_2018.md
Last active October 23, 2018 02:55
Another stupid electronic musical instrument

Instrument for 2018

Before spending time and money building a lot of electronics, let's prototype the thing in Javascript.

Hmm. Maybe a better idea would be to make up a board that accepts a Teensy 3.6, and provides audio hardware, and a bunch of pushbuttons and a few other controllers. Then you can develop code on a real Teensy with representative hardware support. When you go to the real instrument you're only changing the form factor, and maybe the number of buttons or switching to touch-sensitive or whatever.

Prior art - the Tooba, 2015