Skip to content

Instantly share code, notes, and snippets.

View en0's full-sized avatar

Ian Laird en0

View GitHub Profile
@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
#!/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 / i3notify.py
Created June 20, 2014 02:14
Oversimplified weechat notification script using libnotify
import weechat as w
import subprocess as s
SCRIPT_NAME = "i3notify"
SCRIPT_AUTHOR = "Ian Laird <[email protected]>"
SCRIPT_VERSION = "1.0"
SCRIPT_LICENSE = "GPL3"
SCRIPT_DESC = "Send notifications to i3-nagbar"
ICON_PATH = '/usr/share/icons/hicolor/32x32/apps/weechat.png'
@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 / tracerout.py
Created July 26, 2014 03:22
My traceroute program in python using scapy.
#!/bin/usr/env python2
from scapy.all import *
from argparse import ArgumentParser
from sys import argv
from time import time
# shut up scapy
conf.verb=0
@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)