Skip to content

Instantly share code, notes, and snippets.

View gwerbin's full-sized avatar
💭
I might be slow to respond.

Greg Werbin gwerbin

💭
I might be slow to respond.
View GitHub Profile
@gwerbin
gwerbin / shebang.zsh
Last active January 16, 2017 13:53
"Shebang" function for Zsh
# shebang [-iv] [-t interpreter] [-I extension] [-J [extension]] [filename]
#
# If no filename is given, print a shebang. If a filename is given, append a shebang to the file and print its contents. If a filename is given and the -I or -J options are specified, append a shebang to the file in place.
#
# OPTIONS
# -i
# Interactive mode; ask for confirmation first.
# -I
# Modify "filename" in place (as in `sed -i`) using specified extension. Extension is mandatory.
# -J
#! /usr/bin/env Rscript
library(mvtnorm) # `install.packages('mvtnorm')`
set.seed(507734)
Y1 <- rmvnorm(n = 1e4, mu = c(9, 9), sigma = diag(2))
Y2 <- rmvnorm(n = 1e4, mu = c(18, 18), sigma = 4 * diag(2))
Y <- rbind(Y1, Y2)
@gwerbin
gwerbin / zinstall
Last active March 10, 2017 16:56
An alternative run-script for Dotbot
#! /usr/bin/env zsh -f
# vim: set filetype=zsh:
setopt err_exit glob_star_short clobber
ZOTBOT_VERSION='0.1.0'
zparseopts -D \
h=help -help=help \
V=version --version=version \
intensity number color rgb hex
normal 0 Black 0, 0, 0 #000000
normal 1 Red 170, 0, 0 #aa0000
normal 2 Green 0, 170, 0 #00aa00
normal 3 Brown/yellow 170, 85, 0 #aa5500
normal 4 Blue 0, 0, 170 #0000aa
normal 5 Magenta 170, 0, 170 #aa00aa
normal 6 Cyan 0, 170, 170 #00aaaa
normal 7 Gray 170, 170, 170 #aaaaaa
bright 0 light_Darkgray 85, 85, 85 #555555

Keybase proof

I hereby claim:

  • I am gwerbin on github.
  • I am symbolizm (https://keybase.io/symbolizm) on keybase.
  • I have a public key ASCNV3zYHbzDj5UVl0o3U2JR4ArWRY4_b_L6UV6mrJaoEwo

To claim this, I am signing this object:

@gwerbin
gwerbin / switches.txt
Last active May 24, 2020 20:37
Keyboard Switches 2018
Todo:
- Various switches from Mechbox: Content, Kai-Cheng, Tomato, et al.
- Mod switches
- Revo switches
- non-MX switches (Alps, low-profile ML-style, others)
- Razer switches made by Kailh and Greetech
- Database -- bottom-out and actuation weights, mount availability (pcb/plate), led compatibility/availability
Notes:
- Outemu switches are manufactured by Gaote
@gwerbin
gwerbin / nonstandard-keys.txt
Last active March 7, 2018 21:53
Keyboard layout keycap requirements
Rows, in order from top to bottom:
- func
- 1234
- asdf
- zxcv
- mod / cmod
- usually the same contour as zxcv
- "cmod" = "convex mod", or can be replaced w/ inverted mod/zxcv, e.g. Shift, Numpad 0, etc.
ANSI 60%
{
"keyboard": "kbd75/rev1",
"keymap": "kbd75/rev1_layout_ansi_mine",
"layers": [
[
"KC_ESC",
"KC_F1",
"KC_F2",
"KC_F3",
"KC_F4",
@gwerbin
gwerbin / demo.py
Last active August 8, 2018 21:57
Demonstration of label alignment in a sklearn multiclass estimator
import numpy as np
from sklearn.metrics import make_scorer, log_loss
from sklearn.model_selection import RandomizedSearchCV, StratifiedKFold
from sklearn.naive_bayes import BernoulliNB
rs = np.random.RandomState(99984)
y = [
'cow',
'hedgehog',
@gwerbin
gwerbin / LICENSE.txt
Last active November 30, 2018 00:50
Space-efficient distance matrix
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for