Skip to content

Instantly share code, notes, and snippets.

Chad chadmiller

Block or report user

Report or block chadmiller

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View generate_middle_c
#!/bin/bash
""":"
# Run a pulseaudio wrapper. Fancy ugly hack.
exec padsp -d python3 "$0" "$@"
"""
import struct
import numpy
from scipy import signal
View ayan-url-example.py
#!/usr/bin/env python3
from urllib import request, error as urlliberror
from bs4 import BeautifulSoup as BS
import multiprocessing
from contextlib import suppress
def get_title(url):
with suppress(urlliberror.HTTPError):
page = request.urlopen(url)
@chadmiller
chadmiller / .xsessionrc
Created Nov 5, 2017
xps13 touchpad xinput setup
View .xsessionrc
xinput set-prop "DLL075B:01 06CB:76AF Touchpad" "Synaptics Tap Time" 0
xinput set-prop "DLL075B:01 06CB:76AF Touchpad" "Synaptics Palm Detection" 1
xinput set-prop "DLL075B:01 06CB:76AF Touchpad" "Synaptics Click Action" 1 3 2
xinput set-prop "DLL075B:01 06CB:76AF Touchpad" "Synaptics Scrolling Distance" -27 -27
height=$((680-1))
width=$((1216-1))
to_edge=0
xinput set-prop "DLL075B:01 06CB:76AF Touchpad" "Synaptics Soft Button Areas" \
View gist:d948eb0922de19c62bb4d2788ba2d4ff
$ xinput list-props 11
Device 'DLL075B:01 06CB:76AF Touchpad':
Device Enabled (137): 1
Coordinate Transformation Matrix (139): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (260): 1
Device Accel Constant Deceleration (261): 2.500000
Device Accel Adaptive Deceleration (262): 1.000000
Device Accel Velocity Scaling (263): 12.500000
Synaptics Edges (264): 48, 1167, 36, 507
Synaptics Finger (265): 25, 30, 0
View message_wrapping.py
#!/usr/bin/env python3
import doctest
import string
def break_into_chunks(message, allowance, characters_that_count_for_one, characters_that_count_for_two):
cursor = 0
allotted = 0
View gist:03cd6e86051c3ed656a2daff91e6bf61
### database api, via HTTP(s), REST
## GET only
/api/1/get_directories
# out, text/json: { "Foo Foo": "long description", "Street Art": "Temporary and Semipermanent art" }
## GET only
/api/1/get_points_by_place/(\d+)/(\d+)/(\w+)
# retrieves JSON of closest 1000 items
View mdupont-cgv-coord-extract
xscale, yscale = [7957825782578148e-20,4393119311931213e-20]
xtranslate, ytranslate = [-81.658611,28.346828]
for arc in arcs:
xd, yd = arc.pop(0)
print([(((x+xd)*xscale+xtranslate), ((y+yd)*yscale+ytranslate)) for x, y in arc])
View keybase.md

Keybase proof

I hereby claim:

  • I am chadmiller on github.
  • I am qengho (https://keybase.io/qengho) on keybase.
  • I have a public key whose fingerprint is C2C3 0E6C A4CE D49E 79CF 6C61 A806 DEAC 3042 0066

To claim this, I am signing this object:

@chadmiller
chadmiller / Makefile
Last active May 4, 2016
Orange County business licenses
View Makefile
#!/usr/bin/make -f
demo: orange-county-business-licenses.sqlite3
sqlite3 $< "select count(*) g, description from business_licenses group by description order by g, description;"
orange-county-business-licenses.sqlite3:
sqlite3 $@ "create table business_licenses (category int not null, account text, businessname text, streetaddress text, citystatezip text, unknown1 int, unknown2 int, unknown3 int, owner text, description text, phonenumber text, licensuredate text);"
set -u; seq 220 |while read weeksago; do wget -nv -O - $$(date +"https://www.octaxcol.com/Octc/Downloads/LocalBusinessTax/Data/%Y-%m-%d.zip" --date "$$weeksago weeks ago Friday") |funzip |sed -e 1d |awk -F, 'BEGIN { OFS=FS } { if ($$11 == "000-000-0000") { $$11=""; } print }' |sqlite3 -bail -stats -cmd '.separator ","' $@ '.import /dev/stdin business_licenses'; done
View offline gpg.md

Offline GPG

Goals and Overview

Never put secret keys on a machine that reaches the internet. Store daily-use keys in a black box that does crypto for you, and store master key in disconnected offline storage.

You can’t perform that action at this time.