Skip to content

Instantly share code, notes, and snippets.

View timkeller's full-sized avatar

Tim Keller timkeller

View GitHub Profile
@timkeller
timkeller / application.js
Created February 9, 2012 11:23
JS to make .subnav sticky
!function ($) {
$(function(){
// fix sub nav on scroll
var $win = $(window)
, $nav = $('.subnav')
, navTop = $('.subnav').length && $('.subnav').offset().top - 40
, isFixed = 0
@timkeller
timkeller / gist:1870762
Created February 20, 2012 19:04
A few quick timezone conversions for a friend (and his co-workers)
<?php
/*
PARSE CSVs OF SHIFT DATA
FORMAT: Note that spaces outside of < >'s are significant. ( )'s indicate optional
<Shift Number>, <start-end>(,<start-end>), <Days of the week off>
eg. Shift 16, 0700-1200,1700-2200, Mon,Tue,Wed off
eg. Shift 102, 0900-1930, Wed,Thu,Sat off
@timkeller
timkeller / multidb-alter-syntax-generator.sql
Created March 1, 2012 14:49
Quick generator, in sql, to create ALTER sql instructions for a set of databases of the same schema on the same MySQL server
SELECT
CONCAT(
'ALTER TABLE `',
TABLE_SCHEMA,
'`.`',
TABLE_NAME,
'` ADD `change-field-name` VARCHAR(5) NULL DEFAULT NULL',
';'
) AS sql_string
FROM
@timkeller
timkeller / count-in-a-week.sql
Created March 2, 2012 13:10
For a simple user awards system: Show all users who received more than 3 awards in a single calendar week. Exclude awards that have already been issued.
SELECT user_id,
COUNT(*) AS num,
date_format(creation_date, '%Y%u') AS theweek,
FROM awards
WHERE issued = 0
GROUP BY user_id, theweek
HAVING num >= 3;
@timkeller
timkeller / redbull-stratos-api-log.php
Created October 14, 2012 17:44
Logging the Redbull Stratos API
<?php
/*
Log RedBullStratos Telemetry
Each telemetry data point is in the form:
[AltitudeImperial] => 103477.69028871
[AltitudeIsValid] => 1
# PhpMyAdmin
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(. \.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
@timkeller
timkeller / exifout.py
Last active August 29, 2015 14:03
Export EXIF data as a simple string
# EXIF Exporter
# ==============
# Exports EXIF data in a nice string format. For example:
# "Canon EOS 650D, EF-S18-55mm f/3.5-5.6 IS II, 1/200, f/9, ISO 100"
#
# It will also copy it to your clipboard
#
# Make sure you have PIL or Pillow installed
# This probably means you'll need to run:
# pip install Pillow
@timkeller
timkeller / gist:559d8289929cb22ff043
Created May 13, 2015 21:31
Mikrotik Progressive Brute Force Blocking
add chain=input protocol=tcp dst-port=22 src-address-list=ssh_blacklist action=drop comment="drop ssh brute forcers" disabled=no
add chain=input protocol=tcp dst-port=22 connection-state=new src-address-list=ssh_stage3 action=add-src-to-address-list address-list=ssh_blacklist address-list-timeout=10d comment="" disabled=no
add chain=input protocol=tcp dst-port=22 connection-state=new src-address-list=ssh_stage2 action=add-src-to-address-list address-list=ssh_stage3 address-list-timeout=1m comment="" disabled=no
add chain=input protocol=tcp dst-port=22 connection-state=new src-address-list=ssh_stage1 action=add-src-to-address-list address-list=ssh_stage2 address-list-timeout=1m comment="" disabled=no
add chain=input protocol=tcp dst-port=22 connection-state=new action=add-src-to-address-list address-list=ssh_stage1 address-list-timeout=1m comment="" disabled=no
@timkeller
timkeller / 52-week-photo.taskpaper
Last active January 1, 2017 15:01
52 Week Photo Challenge (Dogwood Year 1) for Omnifocus
52 Photos:
- W1 Portrait: Self Portrait @due(7 Jan)
Start things off right with a "selfie"! Explore the self timer setting on your camera.\
- W2 Landscape: Traditional Landscape @due(7 Jan + 1w)
Shoot a beautiful landscape and share it with the world. Find a nice foreground and don't forget the sky.
- W3 Artistic: Red @due(7 Jan + 2w)
Shoot whatever inspires you. Red should be the focus of the image. Don't be afraid to be creative.
- W4 Portrait: Headshot @due(7 Jan + 3w)
You shot a selfie, now shoot a "selfie" of someone else!
- W5 Landscape: Black and White @due(7 Jan + 4w)
@timkeller
timkeller / 52-week-photo.csv
Last active January 1, 2017 15:29
52 Week Photo Challenge (CSV)
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
"Week","Title","Description", "Deadline"
"1","Portrait: Self Portrait","Start things off right with a selfie! Explore the self timer setting on your camera.","07-Jan-17"
"2","Landscape: Traditional Landscape","Shoot a beautiful landscape and share it with the world. Find a nice foreground and don't forget the sky.","14-Jan-17"
"3","Artistic: Red","Shoot whatever inspires you. Red should be the focus of the image. Don't be afraid to be creative.","21-Jan-17"
"4","Portrait: Headshot","You shot a selfie, now shoot a selfie of someone else!","28-Jan-17"
"5","Landscape: Black and White","Look for a scene with great contrast that will make a great black and white.","04-Feb-17"
"6","Artistic: Candy","Your artistic interpretation this week should be inspired by something sweet. A great chance to play with macro photography.","11-Feb-17"
"7","Portrait: Faceless","Tell someone's story without showing their face.","18-Feb-17"
"8","Landscape: Wide Angle/Panorama","This is a great opportunity to explore panorama stitching