This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
# put whatever code here | |
except: | |
import traceback, StringIO, re, os | |
def colorize(text, color): | |
control_sequence_introducer = "\x1B[" | |
return "{0}{1}m{2}{0}0m".format(control_sequence_introducer, color, text) | |
exception_output = StringIO.StringIO() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://ubuntuforums.org/showthread.php?t=1865589 says to do this | |
sudo apt-get install build-essential python-all-dev liblcms1-dev libjpeg62-dev libpaps-dev | |
# Uniconvertor packages do not seem to install properly on Ubuntu 12.04, so | |
# I installed from source. | |
svn co https://sk1.svn.sourceforge.net/svnroot/sk1/trunk/sk1libs /tmp/sk1libs | |
sudo python /tmp/sk1libs/setup.py install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Run this from a directory containing *.cgm files to create SVG copies. | |
Dir.glob('*.cgm').each do |file| | |
cmd = "uniconvertor '#{file}' '#{File.basename(file, '.cgm')}.svg'" | |
puts cmd | |
system cmd | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def colorize(text, color_code) | |
"\e[#{color_code}m#{text}\e[0m" | |
end | |
begin | |
# Here be dangerous things. | |
rescue => e | |
print "\r" << (' ' * 50) << "\n" | |
stacktrace = e.backtrace.map do |call| | |
if parts = call.match(/^(?<file>.+):(?<line>\d+):in `(?<code>.*)'$/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'nokogiri' | |
puts "Using Nokogiri version: #{Nokogiri::VERSION}" | |
# HTML5 document with inline SVG. | |
html = <<-HTML | |
<!DOCTYPE html> | |
<html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
the Dorian used 0.00039800 know. 0.04128765358980413 want I to 0.00092700 Gray | |
0.00008100 I you What 0.00079500 what you want. want do 0.00001000 | |
turning round. exclaimed 0.00063700 I dont know 0.00053500 0.00074800 | |
he dont 0.00005400 mean Basil you 0.00086500 what know 0.00080200 | |
be 0.00070700 I that 0.00028500 0.00022700 some Dorianor day. shall | |
am 0.00067400 Well vain. to 0.00005500 I for punished be 0.00008200 | |
me 0.00005500 owe 0.00050800 I You you. taught only 0.00032800 to | |
Harry at said lastmore 0.00097100 0.00097900 Basil he 0.00006900 than | |
0.00089000 0.00047200 moments. great deal I 0.00078500 to a owe few | |
0.00064200 green the garden 0.00060700 flickering for 0.00014600 a |