Skip to content

Instantly share code, notes, and snippets.

View en0's full-sized avatar

Ian Laird en0

View GitHub Profile
@en0
en0 / etcd-init
Last active August 26, 2015 07:25
#!/bin/bash
### BEGIN INIT INFO
# Provides: etcd
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Init for etcd
# Description: etcd 2.0 distributed key-value store
### END INIT INFO
#!/bin/env python3
from html.parser import HTMLParser
from urllib import request
class ExcuseParser(HTMLParser):
def __init__(self):
super(ExcuseParser, self).__init__()
self._content = None
self._title = None
@en0
en0 / Makefile
Last active August 29, 2015 13:57
Makefile for Arduino
TARGET=Blink
LIB=core.a
CORE_INC=/usr/share/arduino/hardware/arduino/cores/arduino/
PLAT_INC=/usr/share/arduino/hardware/arduino/variants/mega/
F_CPU=16000000L
FORMAT=ihex
MCU=atmega328p
ISP=arduino
PORT=/dev/ttyACM0
@en0
en0 / gmailnotify.py
Last active August 29, 2015 14:02
Check your gmail for new emails
#!/usr/bin/env python2
import urllib2
import feedparser
import subprocess
from os import remove
from time import sleep
FEED_URL = 'https://mail.google.com/mail/feed/atom'
ICON_PATH = '<ICON PATH>'
@en0
en0 / docker tools
Created May 24, 2015 06:07
A quick wrapper for running docker containers
#!/usr/bin/env bash
# Look for existing instances
CID=$(docker ps -a -f name=$CNAME -q)
if [ ! -z "${CID}" ]
then
# Determin if the instance is already running
IS_RUNNING=$(docker inspect --format='{{.State.Running}}' $CID)
@en0
en0 / rot13.py
Last active December 23, 2015 01:09
A simple rot13 implementation.
"""Apply Rot13 cipher to argument list"""
import string
import sys
def rot13(text):
"""Apply the rot13 cipher to the given text
Args:
text: The text to be shifted.
@en0
en0 / Host Proxy
Created November 21, 2013 02:13
Using netcat to proxy a host.
#!/bin/env bash
PORT="${1}"
TARGET="${2}"
[ -z "${3}" ] && TPORT="${1}" || TPORT="${3}"
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 <port> <target> [target port]"
exit 1
fi
@en0
en0 / findDups.py
Created December 29, 2013 23:47
File Duplicate Finder in python using hashlib
#!/bin/env python
import sys
import argparse
import os
import hashlib
def getHashAlgorithyms():
"""Gets a list of hashlib constructures that can be used to generate the digest of a file"""
return {
@en0
en0 / organize.py
Created January 13, 2014 04:22
Organize files into a directory tree using time stamps encoded in the file name.
#!/bin/env python3
import argparse
import sys
import os
import shutil
from datetime import datetime
def migrate(**kwargs):
"""Organize files in a given source to a directory structure
@en0
en0 / keybase.md
Last active February 16, 2017 08:05

Keybase proof

I hereby claim:

  • I am en0 on github.
  • I am irlaird (https://keybase.io/irlaird) on keybase.
  • I have a public key ASCzVEanCrduuo0vHWY1xnGAneMkHGIkA5UdakQnwzvsuQo

To claim this, I am signing this object: