Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
set -e
workdir='~/Downloads';
latest=`curl -L -s http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST`
cd $workdir;
curl -L http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/$latest/chrome-mac.zip -o $workdir/chrome-mac-latest.zip
<?php
// Adds Creative Commons license to WordPress RSS feeds
// Modify this for your site & license
$feed_license = array(
"moduleNamespace" => 'xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"',
"ccNamespace" => 'xmlns:cc="http://creativecommons.org/ns#"',
"link" => "http://creativecommons.org/licenses/by-nc-sa/3.0/",
"ccName" => "Creative Commons BY-NC-SA",
"years" => '2003-'.date("Y")
<?php
// Takes twitter RSS feed, strips the "username: ", removes @replies &
// auto-hyperlinks links
// by Jon Smajda:
// http://jon.smajda.com/blog/2008/07/24/customizing-twitter-rss-with-simplexml/
// get twitter username, 'smajda' is default
$username=$_GET["username"]; // request any username with '?username='
if ( empty($username) ) {
$username='smajda'; // <-- change this to your username!
@smajda
smajda / uploadimg.sh
Created October 6, 2009 13:22
OS X script for resizing and uploading images
#!/bin/sh
# A script for resizing images (using OS X's sips), uploading to a server
# and pasting HTML code to your (OS X) clipboard.
# If you haven't guessed, it requires OS X.
# more info:
# http://jon.smajda.com/blog/2008/04/12/image-upload-script/
set -e
####### set all your variables
imagedir="/tmp" # which local dir should images be saved to?
@smajda
smajda / gist:1621475
Created January 16, 2012 15:51
Add theme version option for bwp minify's cache buster
From 46e9890ead9e23600df5d081e78817e2889eddf2 Mon Sep 17 00:00:00 2001
From: Jon Smajda <jon@smajda.com>
Date: Mon, 16 Jan 2012 09:36:32 -0600
Subject: [PATCH] Add theme version as option for bwp-minify
---
.../bwp-minify/includes/class-bwp-minify.php | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
set bind-tty-special-chars off
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"""
Converts source video files in `sources` to mp4, ogv, and webm 640x360.
Edit `sources` (list of filenames) and adjust `source_dir`, `output_dir`,
and `new_path` as needed.
Reference: http://paulrouget.com/e/converttohtml5video/
"""
import os
import subprocess
@smajda
smajda / gist:5388745
Created April 15, 2013 15:01
wget mirror with options I have to google for everytime.
#!/bin/sh
url='http://someurl.com/'
wait=2 # wait between each request
cutdirs=2 # i.e. if '/foo/bar/data' -> start at 'data'
wget \
--execute="robots=off" \
--mirror \
--convert-links \
@smajda
smajda / gist:6320194
Last active December 21, 2015 14:29
Beer song
from textwrap import dedent
def beer_song():
def describe(quantity):
if quantity > 1:
return '{} bottles'.format(quantity)
elif quantity == 1:
return '1 bottle'
else:
return 'No more bottles'