Skip to content

Instantly share code, notes, and snippets.

@boscomonkey
boscomonkey / brew-install-mysql.txt
Created December 8, 2011 19:17
"brew install mysql" output on Mac OSX Lion
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
mysql_install_db --help
and view the MySQL documentation:
* http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
@boscomonkey
boscomonkey / lcd.rb
Created November 30, 2011 05:18
Ruby Quiz #14 - an evolving solution for SF Ruby Hack night
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
Numbers = [
[" - ",
"| |",
"| |",
"| |",
" - "],
@boscomonkey
boscomonkey / install-meta-packages.sh
Created June 8, 2011 19:30
Commands to install meta-packages for LAMP and Postgresql on Ubuntu Lucid Lynx
#!/bin/sh
sudo apt-get install lamp-server^
sudo apt-get install postgresql-server^
@boscomonkey
boscomonkey / prep-ejabberd.sh
Created June 6, 2011 23:25
MacPorts installation of ejabberd - Before running ejabberd for the first time, you must copy the sample configuration files:
cd /opt/local/etc/ejabberd/
cp ejabberd.cfg.sample ejabberd.cfg
cp ejabberdctl.cfg.sample ejabberdctl.cfg
cp inetrc.sample inetrc
@boscomonkey
boscomonkey / instapaper.js
Created May 26, 2011 16:09
Read Later bookmarklet that doesn't require a 2nd click
javascript:function iprl5(){var d=document,z=d.createElement('scr'+'ipt'),b=d.body;try{if(!b)throw(0);d.title='(Saving...) '+d.title;z.setAttribute('src','http://www.instapaper.com/j/aoOVr4t2wFMs?u='+encodeURIComponent(d.location.href)+'&t='+(new Date().getTime()));b.appendChild(z);}catch(e){alert('Please wait until the page has loaded.');}}iprl5();void(0)
@boscomonkey
boscomonkey / get_head.rb
Created May 24, 2011 00:02
Perform an HTTP HEAD on an URL. Returns a Net::HTTPResponse object to access the status code and headers.
class GetHead
# Returns a Net::HTTPResponse. Get the status code (as string):
# resp = with_http "http://imaiku.me/"
# code = resp.code # => "301"
# resp.each {|k,v| puts k + "\t" + v}
def with_http url
uri = URI.parse url
http = Net::HTTP.start uri.host, uri.port
resp = http.head uri.path
@boscomonkey
boscomonkey / .gitconfig
Created May 12, 2011 23:16
typical Git config preamble
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
@boscomonkey
boscomonkey / iterate_over.js
Created May 10, 2011 00:50
JavaScript code to iterate over an array and add its item values to an ordered list and append to a div
function iterateOver(arry, div) {
var ol = $(document.createElement("ol"););
ol.class("records_list");
div.append(ol);
$.each(arry, function(i, item) {
ol.append("<li>" + item.value + "</li>");
});
}
@boscomonkey
boscomonkey / .bash_rvm
Created April 16, 2011 01:15
rvm goodies for your Bash prompt
# add git branch and rvm ruby@gemset in addition to the usual \u \h \w
source "$rvm_path/contrib/ps1_functions"
ps1_set
@boscomonkey
boscomonkey / gist:741425
Created December 15, 2010 00:46
Transcript from "sudo port install postgresql83-server" on MBP 10.6.5
---> Computing dependencies for postgresql83-server
---> Fetching postgresql83-server
---> Verifying checksum(s) for postgresql83-server
---> Extracting postgresql83-server
---> Configuring postgresql83-server
---> Building postgresql83-server
---> Staging postgresql83-server into destroot
---> Creating launchd control script
###########################################################
# A startup item has been generated that will aid in