Skip to content

Instantly share code, notes, and snippets.

@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
@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 / rps-golf.exs
Last active December 11, 2015 23:45
Elixir Rock Paper Scissors Golf
import Enum
t = 'rps'
c = fn(s)-> into(s,HashSet.new) end
s = (IO.gets'') |> String.strip |> String.to_char_list
case count(Set.difference(c.(s),c.(t))) do
0 when length(s)==3-> ->
e = for x<-s, do: {x,random(t)}
x = sum(map(e,fn(x) -> case x do {x,x}->0;{?r,?s}->1;{?p,?r}->1;{?s,?p}->1;_->-1 end end))
IO.puts map(e,&(elem(&1,1)))
IO.puts(x<0&&"Lose"||x>0&&"Win"||"Draw")
@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 / 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