Skip to content

Instantly share code, notes, and snippets.

@k4ml
k4ml / docs.txt
Last active April 12, 2023 20:21
Python client for Webfaction API
# API Reference¶
The WebFaction [XML-RPC](http://en.wikipedia.org/wiki/XML-RPC) API provides
methods to make many account tasks scriptable. This documentation is a
complete reference to all of the possible API methods.
Please note that XML-RPC parameters are positional (order matters), and many
parameters are required. Parameters may only be omitted if omitted parameters
have default values and follow all other parameters to which you have supplied
a value.
@idan
idan / autoenv.fish
Last active February 8, 2016 15:14
My fish config. I was using oh-my-fish but it seems to introduce a bunch of bugginess.
if not set -q AUTOENVFISH_FILE
set -g AUTOENVFISH_FILE ".env.fish"
end
# Automatic env loading
function _autoenvfish --on-variable PWD
if status --is-command-substitution # doesn't work with 'or', inexplicably
return
end
@capotej
capotej / load-test.rb
Last active December 10, 2015 07:18
basic skeleton for executing tasks in parallel in jruby
require 'java'
java_import 'java.util.concurrent.ThreadPoolExecutor'
java_import 'java.util.concurrent.TimeUnit'
java_import 'java.util.concurrent.LinkedBlockingQueue'
java_import 'java.util.concurrent.FutureTask'
java_import 'java.util.concurrent.Callable'
java_import 'java.util.concurrent.Executors'
### SETTINGS
@robinsloan
robinsloan / langoliers.rb
Last active December 3, 2025 18:13
The Langoliers, a tweet deletion script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@ulfmagnetics
ulfmagnetics / joyent-smartos.erb
Created February 6, 2012 18:42 — forked from benjaminws/joyent-smartos.erb
joyent-smartos.erb
# shove this in ~/.chef/bootstrap/joyent-smartos.erb
# run knife bootstrap <hostname> -d joyent-smartos
bash -c '
if [ ! -f /opt/local/bin/chef-client ]; then
cd /tmp
pkgin -y install gcc-compiler gcc-runtime gcc-tools-0 ruby19 scmgit-base scmgit-docs gmake
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
tar -xzf rubygems-1.8.10.tgz
cd rubygems-1.8.10
-(void)drawInContext:(CGContextRef)myContext {
CGContextSaveGState(myContext);// 6
CGFloat potentialFlip = 1.0;
CGFloat shadowBlur = 4;
CGFloat shadowOffset = 4;
CGFloat shadowOffsetNeg = shadowOffset * -1.0;
CGFloat x = self.bounds.origin.x + shadowOffset;
CGFloat y = self.bounds.origin.y + shadowOffset;
CGFloat wd = self.bounds.size.width - (shadowOffset * 2);
@gruber
gruber / Liberal Regex Pattern for All URLs
Last active October 25, 2025 19:13
Liberal, Accurate Regex Pattern for Matching All URLs
The regex patterns in this gist are intended to match any URLs,
including "mailto:[email protected]", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))