Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# Chromium Updater
# Download and install the newest Chromium build from http://chromium.org
# on Mac OS X.
import urllib2, os.path, sys
BASE_URL = 'http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/'
UPDATE_URL = 'http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST'
DOWNLOAD_PATH = os.path.expanduser('~/Downloads/Chromium Updater')
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
cd
else
# File permissions
run "chmod 755 ."
%w(public log tmp).each do |dir|
run "chmod -R 755 #{dir}"
end
# Remove unnecessary files
%w(README public/index.html public/favicon.ico public/robots.txt).each do |file|
run "rm #{file}"
# $ tweet Hi mom!
#
# Put this in ~/.bashrc or wherever.
# If it doesn't work, make sure your ~/.netrc is right
#
# (Thanks to @anildigital for curl-fu)
function tweet {
curl -n -d status="$*" http://twitter.com/statuses/update.xml &> /dev/null
echo "tweet'd"
#!/bin/bash
# usage: time benchbulk.sh dbname
# it takes about 30 seconds to run on my old MacBook
BULKSIZE=1000
DOCSIZE=100
INSERTS=10
ROUNDS=10
DBURL="http://localhost:5984/$1"
(when (load "flymake" t)
(load "flymake-cursor" t)
(defun flymake-pyflakes-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "/PATH/TO/YOUR/pyflakes" (list local-file))))
require 'net/http'
require 'uri'
# /api/v1/:format/new
# /api/v1/:format/gists/:user
# /api/v1/:format/:gist_id
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'),
{ 'files[file1.ab]' => 'CONTNETS',
'files[file2.ab]' => 'contents' })
@asenchi
asenchi / gist:145506
Created July 12, 2009 03:39
Blog: Working with JQuery
// <script type="text/javascript">
$(document).ready(function() {
$("a").hover(function() {
$(this).parents("p").addClass("highlight");
},function() {
$(this).parents("p").removeClass("highlight");
});
});
// </script>
@asenchi
asenchi / gist:145514
Created July 12, 2009 03:48
Blog: Going with gist
def test_gist():
print "Hello world from gist!"
@asenchi
asenchi / .bashrc
Created July 13, 2009 19:10 — forked from delano/.bashrc
# $ tweet Hi mom!
#
# Put this in ~/.bashrc or wherever.
# If it doesn't work, make sure your ~/.netrc is right
#
# (Thanks to @anildigital and @grundprinzip for curl-fu)
# See: http://curl.netmirror.org/docs/caextract.html
CERTS_URI=http://curl.haxx.se/ca/cacert.pem