Skip to content

Instantly share code, notes, and snippets.

View brandondrew's full-sized avatar

Brandon Zylstra brandondrew

  • UC Berkeley
  • the tubes
View GitHub Profile

Launch a one-off git server from any local repository.

I [tweeted this already][1] but I thought it could use some expansion:

Enable decentralized git workflow: git config alias.serve "daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/"

Say you use a git workflow that involves working with a core "official" repository that you pull and push your changes from and into. I'm sure many companies do this, as do many users of git hosting services like Github.

Say that server, or Github, goes down for a bit.

@brandondrew
brandondrew / script.txt
Created June 24, 2014 23:54
Public CoreOS iPXE Script
#!ipxe
set base-url http://alpha.release.core-os.net/amd64-usr/current
kernel ${base-url}/coreos_production_pxe.vmlinuz sshkey="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDm62LTesk5YC9E7TXc8R9MYJes5NeKZraB+zI2hGpbqI9t31cdZWQBW87Uv8Tne6uD3n4ALSWvTJxrndl80tvC2hz+mLdhF3aiIZQl2jL17JL3rGe7iI7knChq482L5XT7KDVg+0ZEyZhTYvbPVoOJNzPG2BIbrjUyK8f0JUtnvnqJ4zl6tZzTe4rEYTp3YKNAPOv/7868Ka8VywVO3sx78Xj5sHtDWHAm5omrZvajC2jLmG+8N+uKRmY/G25uO8cZOGIB6DI4B0nIu9D9cMWBa+TPnoDKYACdHdwfz8qx1KUtGjS3I9uAcWQCvWXNYICnnhfDQ6hfvseXwKHzC/p7 brandon.zylstra@gmail.com"
initrd ${base-url}/coreos_production_pxe_image.cpio.gz
boot
@brandondrew
brandondrew / visit
Last active August 29, 2015 14:21
Visit another user's OS X account, but get a sane working environment, and set it back to whatever state they had it before when you're done.
#!/usr/bin/env bash
# install:
# curl https://gist.githubusercontent.com/brandondrew/dbed1910ec9ec2a331de/raw/acbab5356c0022e54361e51eff3f9f44780ee842/visit | bash
# TODO: this script should
# * be writtten in Ruby
# * be a single script or app (`drop in` & `drop out`?)
# * generate the 'leave' script, based on current settings and differences
# * generate a complete state of defaults before your visit (so you can restore anything)
@brandondrew
brandondrew / script-generate.bash
Created February 5, 2009 04:45
Never forget to run your migrations again
# add this to your .bash_profile or your .zshrc or whatever
# then use sg (or your preferred abbreviation) instead of script/generate
# and never forget to run migrations again
function sg() {
script/generate $@
echo "Would you like to run the migrations right now?"
read CHOICE
if [ "$CHOICE" = "y" ] || [ "$CHOICE" = "yes" ]
then
echo "rake db:migrate" && rake db:migrate
#!/bin/zsh
mkdir -p /tmp/gist
cd /tmp/gist
curl http://github.com/defunkt/gist/raw/master/gist.rb > gist
chmod 755 gist
sudo mv gist /usr/local/bin/gist
echo "Command-line Gist is now installed"
def date_to_epoch(date, offset)
Time.local(date.year, date.month, date.day + offset).to_i
end
# example:
# departure_date = Date.today
# days_until_return = 1
# puts date_to_epoch(departure_date, days_until_return)
#!/bin/bash
###########################################################
# TRIBUNE-SPECIFIC BUILD HOME script:
# This script sets up your home directory fast with basic
# necessities and amenities, to give you sanity when you
# work on a Unix box where you don't have root access.
###########################################################
# TO USE:
# curl https://raw.github.com/gist/259348/build_home.sh | bash
# OR:
require 'feedzirra'
# fetching a single feed
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing")
# feed and entries accessors
feed.title # => "Paul Dix Explains Nothing"
feed.url # => "http://www.pauldix.net"
feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing"
feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0"
@brandondrew
brandondrew / beanstalkd-macports-1.4.6_1.txt
Created September 30, 2011 00:50
How to fix beanstalkd 1.4.6 compile error (MacPorts)
Just a informational gist if you plan to install "beanstalkd" via MacPorts and get a compiler error:
:info:build net.c: In function 'make_server_socket':
:info:build net.c:35: warning: 'fd' may be used uninitialized in this function
:info:build make[1]: *** [net.o] Error 1
:info:build make[1]: *** Waiting for unfinished jobs....
This is a known issue within the "net.c" file. I've found a diff[1] for said file on the web and applied it locally which then allowed me to install the port without problems.
If your install fails like: