Skip to content

Instantly share code, notes, and snippets.

View icflournoy's full-sized avatar

lan icflournoy

View GitHub Profile
@icflournoy
icflournoy / http-helloworld.py
Created October 7, 2016 19:47
Python3 Hello World
#!/usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
PORT = 9080
class helloWorld_RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-Type', 'text/plain')
self.end_headers()
@icflournoy
icflournoy / date-walker.sh
Last active February 4, 2016 16:31
Bash date walker, accounting for leap years.
#!/bin/bash
# Purpose, to see if we can walk through the months and days appropriately
start_year=1896
end_year=2400
year=$start_year
month=1
day=1
@icflournoy
icflournoy / light.py
Created May 10, 2015 03:50
OSX Tray Light Control
~
#!/usr/bin/env python2.7
import rumps, ledcontroller, argparse
#rumps.debug_mode(True)
class LED(rumps.App):
def __init__(self, endpoint):
super(LED, self).__init__(type(self).__name__, menu = ["On", "Off", "White", "Green", "Red", "Blue"])
self.led = ledcontroller.LedController(endpoint)
@icflournoy
icflournoy / set-affinity.sh
Created September 14, 2014 17:06
Sets the affinity of a number of processes in a round robin fashion
#!/bin/bash
echo Setting affinity
# Set max threads on system
MAX_THREAD=`grep -c "GenuineIntel" /proc/cpuinfo`
CPU_ID=0 # We want to start at 0
while read pid; do
echo "Locking PID: $pid to CPU: $CPU_ID"
@icflournoy
icflournoy / longrunning.py
Created December 9, 2013 18:38
For posterity's sake
#!/usr/bin/python
import time, sys, os
def main():
print "Starting\n"
while 1:
sys.stdout.write(str(time.time()) + ": YOU SHOULD HAVE LET ME SLEEP.\n")
sys.stdout.flush()
time.sleep(90)