Skip to content

Instantly share code, notes, and snippets.

View andyvanee's full-sized avatar

Andy Vanee andyvanee

View GitHub Profile
heroku logs | grep 'heroku\[router\]' | grep -v '\(js\|css\|png\|jpg\|gif\|woff\|ico\)' | grep -v '/Security/ping' | grep -v 'status=404' | grep -o 'service=\d*' | cut -f 2 -d'=' > servicetimes.csv
@andyvanee
andyvanee / every.sh
Created March 2, 2015 17:42
Bash every command
# Put this in your .profile or source it
# Run a command forever
# every 10 "echo hello"
function every() {
timeout=$1 && shift
cmd=$@
while true; do eval "$cmd"; sleep $timeout; done
}
@andyvanee
andyvanee / wp_admins.sql
Created March 2, 2015 21:13
Find all administrators on a wordpress blog
SELECT * FROM wp_users WHERE id IN (
SELECT user_id FROM wp_usermeta
WHERE
meta_key = 'wp_capabilities' AND meta_value LIKE '%administrator%');
@andyvanee
andyvanee / gifify.bash
Created March 18, 2015 22:59
Bash Gifify
# Usage: specify video and width
# gifify my-video.mp4 1200
function gifify {
img="$1"
width=${2-600}
ffmpeg -i "$img" -vf scale=$width:-1 -t 10 -r 10 "$img".gif
}
@andyvanee
andyvanee / ipad-ffmpeg.sh
Created August 18, 2015 17:59
iPad and Web Friendly video conversion
ffmpeg -i input.mp4 -acodec aac -ac 2 -strict experimental -ab 160k -s hd720 -vcodec libx264 -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b:v 1200k -f mp4 -threads 0 output.mp4
@andyvanee
andyvanee / README.md
Last active September 25, 2015 18:25
jQuery plugin to remove widows

Usage

Apply the plugin to whatever tags you want:

$('h1, p').widows();

Be sure that the tags will only contain text content. This will strip HTML content out of the tags passed into it.

@andyvanee
andyvanee / make_node_test_run
Created July 7, 2011 21:40
Makefile for node test and run
.PHONY: test
test:
@ echo ### App Server Starting; echo
@ node app.js >> tst_log.txt 2>&1 &
@ echo; echo '### Running Zombie Tests'; echo
@ sleep 1; node test-http/zombie_tests.js
@andyvanee
andyvanee / MacPyBash.py
Created July 20, 2011 05:04
Tying a native mac UI to shell script via PyObjC.
# 2011, andyvanee
from Foundation import *
from AppKit import *
from Cocoa import *
class LockboxAppDelegate(NSObject):
configPanel = objc.IBOutlet()
srcFolder = objc.IBOutlet()
destFolder = objc.IBOutlet()
@andyvanee
andyvanee / form.html
Created December 15, 2011 20:12
PHP Smarty Form Templating
<h1>Basic Form Template</h1>
{form for=$my_form}
<!-- this is a hidden field -->
{$id.html}
<!-- Default rendering of the field -->
<p>
{if $cms_headline.error}{$cms_headline.error} <br>{/if}
{$cms_headline.label} <br>
{$cms_headline.html}
@andyvanee
andyvanee / ckeditor_config.js
Created January 31, 2012 18:12
File uploads with nterchange ckeditor.
CKEDITOR.editorConfig = function( config ) {
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.toolbar
config.toolbar = [
['Source', '-', 'Cut', 'Copy', 'PasteText', 'Link', 'Unlink'],
['Bold', 'Italic', 'NumberedList', 'BulletedList'],
['HorizontalRule', 'Table', 'Outdent', 'Indent', 'RemoveFormat'],
['Format', 'FontSize']
];
config.uiColor = '#CCC';
config.skin = 'kama';