Skip to content

Instantly share code, notes, and snippets.

@lrvick
lrvick / yubikey.rules
Last active August 18, 2016 00:49
udev to kill/restart scdaemon on yubikey insertion for ssh/gpg
# Yubico Yubikey
ATTRS{idVendor}=="1050", \
ATTRS{idProduct}=="0010|0405|0110|0111|0116", \
ENV{ID_SECURITY_TOKEN}="1", \
RUN+="/bin/bash -c '/usr/bin/killall -9 scdaemon'", \
TAG+="uaccess"
LABEL="yubico_end"
@lrvick
lrvick / cloud-config.yml
Created June 3, 2015 00:45
Example Cloud Config for running CoreOS Enterprise + Build Worker on CoreOS/AWS
#cloud-config
coreos:
etcd:
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $private_ipv4
update:
reboot-strategy: off
@lrvick
lrvick / load-avg.sh
Created April 1, 2015 22:40
Simple siege runner to test multiple steps of workers and log results for quick comparison.
#!/bin/bash
URL=$1
LOG_FILE=$2
WORKER_STEPS=( 10 100 200 500 1000 1500 )
DELAY=10
TEST_LENGTH=60s
for WORKERS in "${WORKER_STEPS[@]}"; do
@lrvick
lrvick / ldapmodify_examples.sh
Last active April 11, 2017 17:05
LDAP Setup Examples
#!/bin/bash
PASSWORD=$1
# Add 'People' unit
ldapmodify \
-h ldap.hashbang.sh \
-D "cn=admin,dc=hashbang,dc=sh" \
-w $PASSWORD \
-a -n <<EOF
@lrvick
lrvick / bathroom-lock.ino
Created March 26, 2015 20:00
Arduino Bathroom Lock State Server
#include <Wire.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE };
EthernetServer server(80);
const int lockPin = 2;
const int ledPin = 13;
@lrvick
lrvick / roll-restart.sh
Last active August 29, 2015 14:17
Rolling CoreOS fleet restart
#!/bin/sh
SERVICE=$1
BRANCH=$2
HEALTH_URL=$3
if [ -z "$HEALTH_URL" ]; then
echo "Syntax: roll-restart someservice somebranch http://localhost:80"
exit
fi
@lrvick
lrvick / leak-recursive.js
Last active April 10, 2018 09:08
iojs/node memory leaks when dealing with promises and infinite loops
// This leaks insane amounts of memory
var fetchCallback = function(resolve, reject) {
resolve({'some':'test'})
}
var fetch = function() {
return new Promise(fetchCallback)
}
@lrvick
lrvick / README.md
Last active May 9, 2024 20:15
Basecamp BS - How to deal with a clueless non-technical manager that insists you log every last second of your day in Basecamp.

Basecamp BS

How to deal with a clueless non-technical manager that insists you log every last second of your day in Basecamp.

I used this for a few weeks to randomly fill in Basecamp time logs to free up time to actually do my job. He was actually commented how satisfied he was with the level of detail I was logging. Since he didn't catch on on his own, I finally explained it was all random scripted nonsense to prove the point that micro time-management serves no purpose. He never brought up time logging again

@lrvick
lrvick / facebook-oauth.py
Created January 28, 2015 09:24
Flask / Python Facebook Graph oAuth Example
#!/usr/bin/python2.6
import os.path
import json
import urllib2
import urllib
import urlparse
import BaseHTTPServer
import webbrowser
APP_ID = '218248774869881'
@lrvick
lrvick / happiness.py
Created January 28, 2015 09:20
Python Happiness Calculator. (Don't ask)
present_happiness = 1
trauma_happiness = present_happiness/10
post_trauma_happiness = present_happiness*2
trauma_years = 1
years_left = 43