Skip to content

Instantly share code, notes, and snippets.

@markolson
markolson / selenium-runner.sh
Created September 2, 2011 00:20
a small bash script to kickstart all the processes needed for selenium testing on os x
# wget http://selenium.googlecode.com/files/selenium-server-standalone-2.5.0.jar
# wget http://chromium.googlecode.com/files/chromedriver_mac_14.0.836.0.zip
if [ -f /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome ]; then
browser="chrome"
elif [ -f /Applications/Firefox.app/Contents/MacOS/firefox ]; then
browser="firefox"
else
echo "Neither Chrome nor Firefox found. Install one."
exit
@markolson
markolson / gist:2571028
Created May 1, 2012 20:13
Horrible bash_profile ssh function for osx
# change terminal theme when I ssh into Important Things.
function ssh() {
local term_theme="Pro" #default
case ${@:(-2):1} in # start at 2nd to last paramter, take one.
*live-demo1*|*prod*|*prod-db*) # production
term_theme="Red Sands"
;;
*selenium*|*hudson*) # testing
term_theme="Silver Aerogel"
@markolson
markolson / run.sh
Created May 10, 2012 15:35
Webdriver/Capybara runner.
if [ -f /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome ]; then
browser="chrome"
elif [ -f /Applications/Firefox.app/Contents/MacOS/firefox ]; then
browser="firefox"
else
echo "Neither Chrome nor Firefox found. Install one."
exit
fi
echo "This opens a screen session with several windows. Once testing is complete, exit all of them to return to this terminal"
DIR="$( cd "$( dirname "$0" )" && pwd )"
@markolson
markolson / stream.sh
Created May 24, 2012 00:59
Play justintv streams in VLC
STREAM=`curl -d "channelname=$1&hoster=justin" http://bogy.mine.nu/sc2/stream2vlc.php | jshon -e 360p -u`
echo "rtmpdump $STREAM | vlc -" | pbcopy
echo 'now, paste, enter, play.'
@markolson
markolson / gist:3045483
Created July 4, 2012 05:14 — forked from akisute/gist:1141953
Create an animated gif file from images in iOS
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
- (void)exportAnimatedGif
{
UIImage *shacho = [UIImage imageNamed:@"shacho.png"];
UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"];
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"];
@markolson
markolson / cbr_to_cbi.py
Last active December 17, 2015 00:48
Sync folders of CBI/CBR/CBZ files to ComicZeal.
#!/usr/local/bin/python
# CopyPaste/print programming & debugging at it's finest.
import os, re, sys, subprocess, time
import zipfile, tempfile
import sqlite3
def main():
print sys.argv
@markolson
markolson / load_chef_node.rb
Created December 7, 2013 05:00
Pass a environment name, node name, and path to a JSON file with a run_list in it, and get back a node that you can call merged_attributes on to get (pretty dang close to) what the node will have as it's attributes during a run. Useful for updating docs to have up-to-date with a pre-commit hook.
# I'm sure this can all be replaced with a one liner, buried deep in chef somewhere.
# Actually, probably Chef::Client.
require 'json'
require 'chef'
require 'chef/application/solo'
require 'chef/knife/deps'
def setup_node(environment, name, node_config_path)
Chef::Config[:config_file] = ".chef/knife.rb"
@markolson
markolson / dependencies.md
Created December 9, 2013 18:21
Sample License Finder output

LicenseFinder

As of December 9, 2013 1:20pm. 61 total, 6 unapproved

Summary

  • 54 MIT
  • 2 other
  • 2 ruby
  • 1 Apache 2.0
  • 1 BSD
@markolson
markolson / embed.patch
Last active August 29, 2015 14:08
Embed Metrics in Graphite Renders
From 23c9be81e4f00040018deec19c73b9484a5fa50e Mon Sep 17 00:00:00 2001
From: Mark Olson <theothermarkolson@gmail.com>
Date: Sun, 2 Nov 2014 16:11:39 -0500
Subject: [PATCH] If PIL is available, embed the metrics used to generate the
graph in the PNG. For reasons.
---
webapp/graphite/render/views.py | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
-- convert -coalesce image.gif ~/Documents/cin/img%02d.png
set i to 0
set wallpaper_folder to (path to home folder as string) & "Documents:cin" as alias
tell application "Finder"
set fileList to (every file of folder wallpaper_folder) as alias list
end tell
tell application "System Events"
repeat