Skip to content

Instantly share code, notes, and snippets.

View suttree's full-sized avatar
🤔
copacetic/autotelic

Duncan Gough suttree

🤔
copacetic/autotelic
View GitHub Profile
#! /usr/bin/env python
# Wikemail.py - import your emails into dokuwiki to create
# a searchable, wiki-able archive of you mail - Duncan Gough 23/10/04
import getpass, imaplib, re, rfc822, commands, email, os
#from TaskThread import TaskThread
import threading
class ImapWiki(threading.Thread):
require 'rubygems'
require 'tweetstream'
require 'pp'
require 'json'
a = {:name => 'Olly', :total => 0, :previous => 0, :speed => 0}
b = {:name => 'Joe', :total => 0, :previous => 0, :speed => 0}
start_time = Time.now.to_i
end_time = Time.now.to_i
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
i
me
my
myself
we
our
ours
ourselves
you
your
@peterhost
peterhost / node_debian_init.sh
Created November 25, 2010 11:41
Daemon init script for node.js based app/server (DEBIAN/UBUNTU)
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@ryana
ryana / url_regex.rb
Created August 8, 2011 19:23
@gruber's improved regex for matching URLs written in Ruby
# From @gruber http://daringfireball.net/2010/07/improved_regex_for_matching_urls
UrlRegex = /\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/?)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s\`!()\[\]{};:\'\".,<>?«»“”‘’]))/i
@wkrsz
wkrsz / gist:1404434
Created November 29, 2011 11:10
Retrieve Gmail Thread IDs
# Code example for http://wojt.eu/post/13496746332/retrieving-gmail-thread-ids-with-ruby
def patch_net_imap_response_parser(klass = Net::IMAP::ResponseParser)
klass.class_eval do
def msg_att
match(T_LPAR)
attr = {}
while true
token = lookahead
case token.symbol
@turicas
turicas / example_image_utils.py
Created December 10, 2011 19:04
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@besi
besi / Environment.h
Created May 24, 2012 14:56
Environment
//
// Environment.h
//
#import <Foundation/Foundation.h>
// Convenience Macros
#define ENVIRONMENT_PROPERTY(key) @property (readonly) NSString *key;
#define ENVIRONMENT_PROPERTY_BOOL(key) @property (readonly) BOOL key;
@jotto
jotto / google_oauth2_access_token.rb
Created June 14, 2012 21:15
ruby command line script for generating google oauth2 access token
# (create oauth2 tokens from Google Console)
client_id = ""
client_secret = ""
# (paste the scope of the service you want here)
# e.g.: https://www.googleapis.com/auth/gan
scope = ""