Skip to content

Instantly share code, notes, and snippets.

function matte() {
composite $1 -size `identify $1 | egrep -o "[0-9]+x[0-9]+" | head -n 1` "xc:$2" $3
}
require File.dirname(__FILE__) + '/../spec_helper'
describe DetailsPage do
before do
@desc = companies(:fleishman).crawl_description
@session = @desc.crawl_sessions.create!
@simple_html = <<-HTML
<html>
<body>
<h1 class="iCIMS_Header_JobTitle">CEO</h1>
#!/bin/bash
for ARG in "$@"
do
echo banning $ARG
iptables -A INPUT -s $ARG -j DROP
done
kyles-macbook:csvget kyle$ ./bin/jsonget --parselet=../hndemo/hn.let http://news.ycombinator.com -R '.*'
kyles-macbook:csvget kyle$ cat hn.let.json
{ "headlines": [ { "title": "Simpson's paradox: why mistrust seemingly simple statistics", "link": "http:\/\/en.wikipedia.org\/wiki\/Simpson%27s_paradox", "comments": "6", "user": "waldrews", "score": "71", "time": "5 hours ago" }, { "title": "America's unjust sex laws", "link": "http:\/\/www.economist.com\/opinion\/displaystory.cfm?story_id=14165460", "comments": "80", "user": "MikeCapone", "score": "77", "time": "5 hours ago" }, { "title": "The Facebook Exodus", "link": "http:\/\/www.nytimes.com\/2009\/08\/30\/magazine\/30FOB-medium-t.html?_r=1&nl=technology&emc=techupdateema1", "comments": "3", "user": "smharris65", "score": "8", "time": "54 minutes ago" }, { "title": "Buy somebody lunch", "link": "http:\/\/www.whattofix.com\/blog\/archives\/2009\/08\/buy-somebody-lu.php", "comments": "34", "user": "DanielBMarkham", "score": "68", "time": "6 hours ago" }, { "t
kyles-macbook:scratch kyle$ cat carfolio.let
{
"specs": [{
"name": ".main a",
"specs": ".main div"
}]
}
kyles-macbook:scratch kyle$ parsley carfolio.let http://www.carfolio.com/specifications/models/?man=557
{ "specs": [ { "name": "2009 Audi A3 1.6 TDI ", "specs": "Brief specs: 3 doors FF 4 cylinder 1598 cc 89.0 bhp\/90.2 PS 1280 kg 118.0 CO2" }, { "name": "2009 Audi A3 1.6 TDI ", "specs": "Brief specs: 3 doors FF 4 cylinder 1598 cc 104.0 bhp\/105.4 PS 1280 kg 109.0 CO2" }, { "name": "2009 Audi A3 Cabriolet 1.6 TDI ", "specs": "Brief specs: 2 doors FF 4 cylinder 1598 cc 104.0 bhp\/105.4 PS 1430 kg 114.0 CO2" }, { "name": "2009 Audi A3 Sportback 1.6 TDI ", "specs": "Brief specs: 5 doors FF 4 cylinder 1598 cc 89.0 bhp\/90.2 PS 1320 kg 119.0 CO2" }, { "name": "2009 Audi A3 Sportback 1.6 TDI ", "specs": "Brief specs: 5 doors FF 4 cylinder 1598 cc 104.0 bhp\/105.4 PS 1320 kg 112.0 CO2" }, { "name": "2009 Audi A4 1.8 TFSI Multitronic ", "specs": "Brief specs: 4 doors FF 4 cylinder 1798 cc 118.0 bhp\/11
This file has been truncated, but you can view the full file.
kyles-macbook:scratch kyle$ gdb ruby
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries ..... done
(gdb) run `which csvget` --directory-prefix=./data -A "/models/" -w 5 --parselet=carfolio.let http://www.carfolio.com/specifications/
#!/usr/bin/env ruby
# Packaged as a gem, too.
# gem install fizx-remind
system *ARGV
status = $?
system "growlnotify", "-m", "#{ARGV.first} is finished", "remind"
exit status.to_i
#!/usr/bin/env ruby
if ARGV.length == 0
puts "Usage: #{$0} GEM_NAME [GEM_NAME ...]"
exit 1
end
ARGV.each do |name|
File.open("/tmp/#{name}.gemspec", "w") do |file|
file.puts <<-RUBY
Gem::Specification.new do |s|
kyles-macbook:pyparsley kyle$ sudo python setup.py install
running install
running build
running build_ext
building 'pyparsley' extension
creating build
creating build/temp.macosx-10.6-universal-2.6
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/usr/include -I/usr/local/include -I/opt/local/include -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/libxml2 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c pyparsleymodule.c -o build/temp.macosx-10.6-universal-2.6/pyparsleymodule.o
pyparsleymodule.c: In function ‘pythonize_recurse’:
pyparsleymodule.c:119: warning: pointer targets in passing argument 2 of ‘PyDict_SetItemString’ differ in signedness
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyparsley import *
>>> p = PyParsley({'title': 'title'})
>>> p.parse(file = "test/yelp.html")
{'title': "\t\tNick's Crispy Tacos - Russian Hill - San Francisco, CA\n"}