Skip to content

Instantly share code, notes, and snippets.

@pearkes
pearkes / gist:1621910
Created January 16, 2012 17:27
One-line static site on Heroku
touch index.php; echo 'php_flag engine off' > .htaccess; git init; heroku create -s cedar; git add -A && git commit -m "initial"; git push heroku master;
@pearkes
pearkes / app.py
Created February 19, 2012 16:35
Using url_for() to separate static paths on dev/prod with Flask
...
STATIC_PATH=str(os.environ.get("STATIC_PATH"))
@app.route(STATIC_PATH, build_only=True)
def static_path():
pass
...
@pearkes
pearkes / VagrantFile
Created March 17, 2012 23:31
Foreman-Ready Vagrant Box with Provisioner. Precise64 and Ruby 1.9.3.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
@pearkes
pearkes / gist:2209293
Created March 26, 2012 20:07
one line lint install for Sublime
$ git clone git://github.com/lunixbochs/sublimelint.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/sublimelint/
@pearkes
pearkes / gist:2403889
Created April 17, 2012 06:26
Google Weather Conditions
<!--
Google Weather API Conditions. Compiled by Dennis Delimarsky
-->
<!-- Last updated: March 12, 2010 -->
<conditions>
<type>PARTLY SUNNY</type>
<type>SCATTERED THUNDERSTORMS</type>
<type>SHOWERS</type>
<type>SCATTERED SHOWERS</type>
<type>RAIN AND SNOW</type>
@pearkes
pearkes / git-completion.bash
Created July 27, 2012 16:20
git-completion.bash
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@pearkes
pearkes / gist:4069203
Created November 13, 2012 23:45
My shell prompt, with Vagrant and Git status.
# Example: http://s.jack.ly/iXhJ
prompt() {
PS1="${GREEN}\W\$(parse_git_branch) $BROWN\$(parse_vm_state) ${GREEN}→ ${GREY}"
PS2="\[[33;1m\]continue \[[0m[1m\]> "
}
parse_git_branch() {
#!/usr/bin/env bash
# Run as root (sorry mom) like this: curl http://gist/test.sh | sed 's/defaulthost/pablo/g' | sudo sh
# This basically turns on ssh and sets a new hostname.
scutil --set HostName defaulthost
echo "Succesfully changed hostname to `hostname`"
echo "Enabling SSH access.."
systemsetup -setremotelogin on
@pearkes
pearkes / flactomp3
Last active December 18, 2015 14:18
flactomp3 converts a directory of flac files into 320 mp3's. Installation instructions below.
#!/bin/sh
# Converts a directory of .flac files to the proprietary and lossy
# .mp3 format, retaining meta data.
#
# Note: Requires ffmpeg (brew/apt-get install ffmpeg)
#
# Use:
#
# flactomp3 DIRECTORY
@pearkes
pearkes / host
Created June 30, 2013 17:55
If you run `host` with https://google.com, this strips the https://
#!/bin/sh
# cp host /usr/local/bin/
# I only use host for checking records, and 9 times out of 10
# I copy paste the url from my browser. Chrome adds http[s]://
if [ -n "$1" ]
then
# 1 parameter, let's do this thing
/usr/bin/host ${1#*//}