Skip to content

Instantly share code, notes, and snippets.

#!python
"""Bootstrap distribute installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from distribute_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools, set a download
@epylinkn
epylinkn / mktouch
Created June 25, 2013 20:17
got tired of doing: mkdir -p path/to/file && touch path/to/file/filename.txt
function mktouch {
mkdir -p `dirname $1`
touch $1
}
@epylinkn
epylinkn / ssh-config
Created July 18, 2013 03:07
ssh-config => a ruby script for easily managing your ssh config shortcuts so that you don't need to type beasts like: ssh -i ~/.ssh/thisisapemkey.pem ubuntu@ec2-amazon-has-really-difficult-hostnames.amazonaws.com
#!/usr/bin/env ruby
require 'thor'
class SSHConfig < Thor
desc "list", "list all hosts"
def list()
f = File.open("/Users/#{ENV['USER']}/.ssh/config", 'r')
hosts = f.select { |line| line =~ /Host\s/ }
hosts.map { |host| host[4..-1].strip }.each do |host|
@epylinkn
epylinkn / gist:6052086
Created July 22, 2013 07:58
underscorify on a directory
for i in *.png; do [[ "$i" = *-* ]] && mv -nv -- "$i" "${i//-/_}"; done
(defadvice ruby-indent-line (after unindent-closing-paren activate)
(let ((column (current-column))
indent offset)
(save-excursion
(back-to-indentation)
(let ((state (syntax-ppss)))
(setq offset (- column (current-column)))
(when (and (eq (char-after) ?\))
(not (zerop (car state))))
(goto-char (cadr state))
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Change bash prompt emoji by time.
time_emoji() {
CURRENT_HOUR=`date +"%-H"`
if [ "$CURRENT_HOUR" -ge 17 ] && [ "$CURRENT_HOUR" -le 23 ]; then
echo $'\xF0\x9F\x8D\xBA' # beer
else
int led_pin = 8;
int switch_pin = 9;
int pot_pin_1 = A1;
int pot_pin_2 = A2;
int pot_pin_3 = A3;
int last_switch_state = LOW;
void setup() {
pinMode(led_pin, OUTPUT);
pinMode(pot_pin_1, INPUT);
@epylinkn
epylinkn / COLORS.md
Created October 3, 2017 02:15
Dope color resources
#include <Servo.h>
#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#include "Wire.h"
#endif
Servo botServo;
Servo topServo;