Skip to content

Instantly share code, notes, and snippets.

@flagranterror
flagranterror / gist:3852795
Created October 8, 2012 14:24
'Watch' command as a bash function.
# I miss 'watch' on OS X
watch () {
clear
if [ -z $2 ]
then
time="5" # Saneish default
watchedcmd=$1
else
time=$(echo $1 | sed -e 's/-n//')
@flagranterror
flagranterror / gist:3853049
Created October 8, 2012 15:12
Rich Text Digest of Reminders
set theStack to {}
tell application "Reminders"
-- Change or remove 'in list "blah"' to suit your needs.
set theList to the reminders in list "Reminders"
repeat with theReminder in theList
if completed of theReminder is false then
set the end of theStack to the name of theReminder
@flagranterror
flagranterror / jot.py
Last active December 12, 2015 03:58
Tiny note file append with timestamps.
#!/usr/bin/env python
import os
import json
from sys import argv
from time import strftime
def firstrun():
x = {}
x['jf'] = raw_input("File name?: ")
@flagranterror
flagranterror / Safari_URL_To_Wedge.applescript
Created February 6, 2013 17:42
Send front Safari URL to Wedge.app
tell application "Safari"
activate
set the clipboard to URL of front document as string
end tell
tell application "Wedge"
activate
end tell
-- You will need to tick "Enable support for assistive
tell application "Google Chrome"
set the clipboard to URL of active tab of front window as string
end tell
tell application "Wedge"
activate
end tell
-- You will need to tick "Enable support for assistive
-- devices" in System Preferences -> Accessibility
tell application "System Events"
@flagranterror
flagranterror / gist:5357783
Created April 10, 2013 19:40
Pull alarm stats from nagios web UI.
#!/usr/bin/python
import urllib2
from base64 import b64encode
import bs4
import time
hostname = 'nagioshost.example.tld'
nagios_prefix = '/nagios'
proto = 'http'
@flagranterror
flagranterror / macreport.py
Created September 4, 2013 03:09
Search a DHCP log file for a list of MAC addresses and print the last (up to) 10 lease times
#!/usr/bin/python
import re
from sys import argv
m = open('macs.txt', 'r').read()
log_file = ''
if '-z' in argv:
from gzip import open
@flagranterror
flagranterror / oui.py
Last active December 25, 2015 00:59
OUI from MAC address
#!/usr/bin/python
"""
Who owns the OUI? IEEE knows.
Run with -u to force update.
"""
from __future__ import print_function
from urllib import urlopen
import sys
@flagranterror
flagranterror / oui3.py
Created April 10, 2014 18:04
Handy OUI lookup script reworked for Python 3+ and (hopefully) all platforms
#!/usr/bin/python
"""
Who owns the OUI? IEEE knows.
Auto-refreshes once a month.
Run with -u to force update.
"""
#!/usr/bin/bash
synclient HorizHysteresis=10 VertHysteresis=10 CircularScrolling=1 CircScrollTrigger=1 TapButton1=1 TapButton2=3 TapButton3=2
syndaemon -i 1.0 -t &