This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Shamelessly stolen from parts of bash-it (https://github.com/hmans/bash-it) | |
alias reload='source ~/.bash_profile' | |
# Directory stuff | |
alias sl=ls | |
alias ls='ls -G' # Compact view, show colors | |
alias la='ls -AF' # Compact view, show hidden | |
alias ll='ls -al' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Lovingly ripped off from Brett Terpstra. | |
# http://brettterpstra.com/grabbing-a-mac-apps-icon-advanced-bash-usage-2/ | |
function geticon() { | |
APP=`echo $1|sed -e 's/\.app$//'` | |
APPDIR='' | |
for dir in "/Applications/" "/Applications/Utilities/" "/Developer/Applications/" "/Developer/Applications/Utilties/"; do | |
if [[ -d ${dir}$APP.app ]]; then | |
APPDIR=$dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# VertiCal: A slim monthly calendar (that's perfect for GeekTool) | |
# by Rob Dumas | |
# Copyright (c) 2012 GNU Public License version 3. | |
# See http://www.gnu.org/licenses/licenses.html for details on this license. | |
import sys | |
import datetime | |
import calendar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Source: http://djangosnippets.org/snippets/1431/ | |
Convert numbers from base 10 integers to base X strings and back again. | |
Sample usage: | |
>>> base20 = BaseConverter('0123456789abcdefghij') | |
>>> base20.from_decimal(1234) | |
'31e' | |
>>> base20.to_decimal('31e') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
fib.py | |
A simple Fibonacci sequencer. | |
by Rob Dumas. | |
Public Domain (no copyright restrictions). | |
If someone using our program wants to get 13 numbers in the Fibonacci sequence | |
(or 10 or 100 or any other number), they have to edit our program by hand. Most | |
people don't want to do this, so Python has LIBRARIES (collections of tools) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# | |
# This script backs up your flash drive to a local folder. If you're also | |
# using a backup system such as Time Machine (and you are, right?), this | |
# ensures you will have a snapshot of your flash drive the last time you | |
# plugged it in. Time Machine will then capture the folder, thus | |
# automatically creating time-based backups for even your portable storage! | |
# | |
# If you use launchd to run this script whenever you plug your flash drive | |
# into your Mac, you don't even need to think about it. Full instructions on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LinksController < ApplicationController | |
# GET /links | |
# GET /links.json | |
def index | |
@links = Link.all | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @links } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Nginx - new server block | |
# http://rosehosting.com | |
# Functions | |
ok() { echo -e '\e[32m'$1'\e[m'; } # Green | |
working() { echo -ne '\e[1;33m'$1'\e[m'; } # Yellow | |
die() { echo -e '\e[1;31m'$1'\e[m'; exit 1; } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# tmvolume.rb | |
# by Rob Dumas <rob@bitsandbooks.com> | |
# Starts and stops the Time Machine volume. Intended to be called from cron. | |
action = ARGV[0] | |
mountpoint = "/mnt/timecapsule" | |
servicefolder = "/etc/init.d/" | |
servicenames = [ "netatalk", "avahi-daemon" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Basic setup script for a fresh Ubuntu machine. Will set the machine's | |
# hostname and install Git, Puppet and ZFS. | |
RELEASE=`lsb_release -s -c` | |
NAME="servername" | |
# Set the machine's hostname. If you pass a name as $1, that hostname | |
# will be used. Otherwise, just change the $NAME variable above. | |
if [ -n "$1" ]; then; unset $NAME && NAME=$1; fi |
OlderNewer