Skip to content

Instantly share code, notes, and snippets.

View brandonzylstra's full-sized avatar
🛤️
Riding the Rails

Brandon Zylstra brandonzylstra

🛤️
Riding the Rails
  • UC Berkeley
  • the tubes
View GitHub Profile
@brandonzylstra
brandonzylstra / rubydo.cr
Last active May 15, 2019 14:35
examples of syntax for RubyDo
# goal: pass code to a Ruby interpreter running in background as a daemon
greeting = "hello"
source = "Ruby"
# desired syntax, which is impossible because the Crystal parser & lexer cannot ignore everything between `ruby do` & `end`
ruby do |greeting, source|
# put Ruby code here as just part of a normal block:
puts "#{greeting} from #{source}!"
end
@brandonzylstra
brandonzylstra / textmate_environment_variables.rb
Created June 20, 2015 03:52
TextMate environment variable reference
#!/usr/bin/env ruby
###############################################################
#
# Paste this into a TextMate document,
# press ⇧^⌥R and choose 'Ruby' from the menu that appears,
# and then press ⌘R to run this in the context of TextMate
# to see all TextMate environment variables and their values
#
###############################################################
@brandonzylstra
brandonzylstra / 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)
@brandonzylstra
brandonzylstra / 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 [email protected]"
initrd ${base-url}/coreos_production_pxe_image.cpio.gz
boot

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.

@brandonzylstra
brandonzylstra / undefined_processingIndicator
Created February 6, 2014 23:32
dynatable.processingIndicator is undefined
<!DOCTYPE html>
<html>
<head>
<title>Ad-Related Reports</title>
<script src="./vendor/jquery-1.7.2.min.js"></script>
<script src="./jquery.dynatable.js"></script>
<link rel="stylesheet" type="text/css" href="./jquery.dynatable.css">
<link rel="stylesheet" type="text/css" href="./bootstrap/css/bootstrap.min.css">
<script src="./bootstrap/js/bootstrap.min.js"></script>
<script src="jquery.ba-replacetext.min.js"></script>
@brandonzylstra
brandonzylstra / tmux_local_install.sh
Created October 19, 2012 00:18 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
TMUX_VERSION="1.7"
LIBEVENT_VERSION="2.0.20"
NCURSES_VERSION="5.9"
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
@brandonzylstra
brandonzylstra / build_home.sh
Last active December 23, 2021 14:16
Script to automatically build your new home directory on Unix or Linux boxes (with Spartan enhancements)
#!/bin/bash
###############################################################
# 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:
# wget https://gist.github.com/raw/3639058/build_home.sh
# bash build_home.sh
@brandonzylstra
brandonzylstra / 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:
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"