Skip to content

Instantly share code, notes, and snippets.

@paulmars
paulmars / gist:1678016
Created January 25, 2012 19:20
ZSH go backwards by 1, 2, 3
alias 1='cd -'
alias 2='cd +2'
alias 3='cd +3'
alias 4='cd +4'
alias 5='cd +5'
alias 6='cd +6'
alias 7='cd +7'
alias 8='cd +8'
alias 9='cd +9'
@paulmars
paulmars / gist:2254680
Created March 30, 2012 20:19
Turn off spotlight
# off
mdutil -i off -a
# on
mdutil -i on -a
@paulmars
paulmars / Gemfile
Created April 10, 2012 21:30
Betabuilder on testflight
source 'https://rubygems.org'
gem "betabuilder"
@paulmars
paulmars / gist:2472987
Last active November 1, 2022 12:06
Spotlight & Time Machine Excludes
You can increase your battery life by removing a couple of folders from your Spotlight index.
Here is my list of folders which made the most difference.
Please fork and update this gist with any additional folders that you've found which are worth removing.
# Most of this was done using Grandperspectiv, which I love
http://grandperspectiv.sourceforge.net/
http://grandperspectiv.sourceforge.net/HelpDocumentation/HowToAnalyseTimeMachineBackups.html
sudo tmutil addexclusion ~/Downloads
@paulmars
paulmars / gist:2722857
Created May 18, 2012 02:45
Turn off background applications
open /Library/StartupItems/
open /Library/LaunchDaemons/
open ~/Library/LaunchDaemons
@paulmars
paulmars / iptables.sh
Created November 28, 2012 18:14
iptables rules (web)
# list everything
/sbin/iptables -L
# load rules
sudo /sbin/iptables-restore < /etc/iptables.up.rules
# need to make sure it starts on reboot
@paulmars
paulmars / gist:4167127
Created November 29, 2012 06:20
Haproxy (two domains, two servers)
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
@paulmars
paulmars / gist:4202156
Created December 4, 2012 09:26
Mac Addresses
require 'rubygems'
require 'awesome_print'
pings = `ping -c4 10.0.1.255`.split("\n")
valid = pings.select{|p| p.match("64 bytes") }
ips = valid.map{|v| v.split(":").first.split(" ").last }.uniq
arps = ips.map{|ip| `arp #{ip} ` }
valid_arps = arps.select{|a| a.match("at") }
@paulmars
paulmars / module.js
Created December 10, 2012 02:59
JS Modules
(function () {
var server = false,
MyModels;
if (typeof exports !== 'undefined') {
MyModels = exports;
server = true;
} else {
MyModels = this.MyModels = {};
}
@paulmars
paulmars / gist:4270905
Created December 12, 2012 19:42
ZombieJS test
login = (browser, email, password, calllback) ->
browser.visit path("/login"), ->
browser.should.be.success
browser.text("title").should.eql("JunoJs - Login")
browser.text("#error-message").should.eql("")
browser.
fill("Email", email).
fill("Password", password).