Skip to content

Instantly share code, notes, and snippets.

@crcastle
crcastle / gist:1568276
Created January 6, 2012 00:58
generic startup script file to put in /etc/init.d
#!/bin/bash
PATH=/bin:/usr/bin:/sbin:/usr/sbin
case "$1" in
start)
echo -n "Starting"
cd /to/somewhere
run_something.sh
@crcastle
crcastle / git-svn notes.txt
Created March 12, 2012 18:26 — forked from dcarney/git-svn notes.txt
Some hastily-scribbled notes about using git-svn with our existing git repos
Set the SVN_EDITOR var:
# export SVN_EDITOR=vim
==================================
SETTING UP A NEW SVN PROJECT
==================================
Create a new SVN "repo" (aka folder):
(NOTE: https is required for our new SVN, as well as --username)
# svn mkdir https://some/url/path/to/newRepo --username first.last
@crcastle
crcastle / memoize.py
Created April 12, 2012 02:36
Expensive function that gets called frequently? Memoize it.
def memoize(fn):
stored_results = {}
def memoized(*args):
try:
# try to get the cached result
return stored_results[args]
except KeyError:
# nothing was cached for those args. let's fix that.
result = stored_results[args] = fn(*args)
@crcastle
crcastle / counter.rb
Created July 4, 2012 07:11 — forked from luigi/counter.rb
Calculate the percentage of tweets linking to a website that came from the Tweet button
#
# Before running:
# $ gem install twitter
#
# To run:
# $ ruby counter.rb sleazywebsite.com
#
# Context:
# http://luigimontanez.com/2012/actually-social-media-buttons-work-really-well
#
githubAccount() { # Syntax: githubAccount <file>
# Check for Github account name
if [[ "$githubAccount" == '' ]]; then
if [[ ! -f "$file" ]]; then
# If .github doesn't exist then ask for the name and save it
echo -n "What is your Github name? "
read githubAccount
touch "$file"
echo "$githubAccount" > "$file"
else

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#!/usr/bin/ruby
# Requirements:
# - rb-dayone and doing gems installed for the system Ruby.
# (Mine (OSX 10.10) are in /Library/Ruby/Gems/2.0.0/gems/)
#
# How to run:
# $./dayone-to-doing.rb 0A8BE4BB9F7E40B5A6F3F621797FC6F5.doentry
# The parameter passed to the script is the doentry file that was just created.
# The script will:

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

Remove osxfuse if installed via homebrew:
> brew uninstall osxfuse
Install osxfuse binary and choose to install the MacFUSE compatibility layer:
http://sourceforge.net/projects/osxfuse/files/latest/download?source=files
Reboot (optional but recommended by osxfuse)
Install ntfs-3g via homebrew:
> brew update && brew install ntfs-3g