Skip to content

Instantly share code, notes, and snippets.

@iangreenleaf
iangreenleaf / rsync-retry.sh
Created January 18, 2010 07:12
rsync with retries
#!/bin/bash
### ABOUT
### Runs rsync, retrying on errors up to a maximum number of tries.
### Simply edit the rsync line in the script to whatever parameters you need.
# Trap interrupts and exit instead of continuing the loop
trap "echo Exited!; exit;" SIGINT SIGTERM
MAX_RETRIES=50
i
me
my
myself
we
our
ours
ourselves
you
your
@ryanflorence
ryanflorence / static_server.js
Last active April 26, 2024 16:18
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@gruber
gruber / gist:1063574
Last active April 15, 2024 20:00
Walken in LA: Hot Dogs

By Christopher Walken

Do you enjoy eating hot dogs? I hope you won’t be put off by my frankness when I tell you that I absolutely love them. In fact, I enjoy no food item more than a freshly-boiled hot dog. Now, I’ve done a lot of movies, and it’s true that I’ve worked with quite a few celebrities who did not share this opinion. I’m sorry to say that these people have always angered me.

There are two types of people in this world: those who eat hot dogs whenever it is possible to do so, and those who opt to do other things with their free time. Who do the latter think they are kidding? What pastime could be more rewarding than the consumption of hot dogs? I haven’t yet found one, and I don’t expect to in my lifetime. Unlike other foods, hot dogs can be eaten at any time, in any place, and it is not necessary to cook them. Now, I ask you: Why not eat hot dogs? They are delicious.

I carry a bag of hot dogs with me wherever I go. I eat them from the bag whenever I get the urge, regardless of the circumstances

alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("")
base = alphabet.length
exports.encode = (i) ->
return alphabet[0] if i is 0
s = ""
while i > 0
s += alphabet[i % base]
i = parseInt(i / base, 10)
@codingjester
codingjester / tumblrv2api.py
Created November 23, 2011 21:22
Working version of Photo Uploads for Tumblr API V2
import urllib,hmac,time,hashlib,base64,httplib,sys,json,urlparse
## This is just a simple example that is self contained.
## You will need to modified it to make it work
##
## creds - need to be filled out
## blognmae - needs to be defined
##
## reads in image files from the command line and posts to your blog
##
@bryanjswift
bryanjswift / .rtorrent.rc
Created December 28, 2011 02:42
rtorrent configuration file with description
# This is an example resource file for rTorrent. Copy to
# ~/.rtorrent.rc and enable/modify the options as needed. Remember to
# uncomment the options you wish to enable.
# Maximum and minimum number of peers to connect to per torrent.
min_peers = 1
max_peers = 100
# Same as above but for seeding completed torrents (-1 = same as downloading)
@kyleturner
kyleturner / Remove Submodule
Created January 5, 2012 01:07
How to remove a submodule from a Github project
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.
@mbostock
mbostock / .block
Last active November 23, 2023 12:00 — forked from mbostock/.block
Point-Along-Path Interpolation
license: gpl-3.0
@ymotongpoo
ymotongpoo / requests-oauth2.py
Created February 25, 2012 07:53
Google API OAuth 2.0 Authorization Sample in Python
# -*- coding: utf-8 -*-
"""
This scripts reqire a third party module 'requests'.
You can get it from PyPI, i.e. you can install it using
easy_install or pip.
http://docs.python-requests.org/en/v0.10.4/
Original source code is written by shin1ogawa, which is in Java.