Skip to content

Instantly share code, notes, and snippets.

@paulmars
paulmars / gist:4459990
Created January 5, 2013 05:43
How to delete a sparse bundle on a drive
for i in {0..1000000}
do
rm -rv /Volumes/DRIVE/FODLER.sparsebundle/bands/$(printf "%x" $i)
done
@paulmars
paulmars / gist:4479432
Last active December 10, 2015 19:08
Testing launchctrl processes
1. set the launcdctr log level to debug
sudo launchctl log level debug
other levels: (debug, info, notice, warning, error, critical, alert, emergency)
2. Tail the system.log
tail -f /var/log/system.log
3. set the launcdctr log level back to error
sudo launchctl log level error
@paulmars
paulmars / gist:4597669
Last active December 11, 2015 11:58
Allow your processes to open more files
Error: accept EMFILE
sudo sysctl -w kern.maxfiles=20480,
@paulmars
paulmars / todo.css
Created February 13, 2013 00:24
Backbone todo, one page
html,
body {
margin: 0;
padding: 0;
}
button {
margin: 0;
padding: 0;
border: 0;
@paulmars
paulmars / gist:5239813
Created March 25, 2013 19:18
Start a server `server 8080`
# add this to your shell
server() {
open "http://localhost:${1}" && python -m SimpleHTTPServer $1
}
@paulmars
paulmars / gist:5256651
Created March 27, 2013 18:08
What is using up my bandwidth.
whonetwork() {
sudo lsof |grep TCP | grep ESTAB
}
@paulmars
paulmars / run.sh
Created April 30, 2013 19:35
How to take a huge screen show of mbostock's work
phantomjs screenshot.js
@paulmars
paulmars / gist:5504428
Created May 2, 2013 18:51
Basic jQuery example for Eric
<p>
hello
</p>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$("p").text("hello more")
</script>
@paulmars
paulmars / bookmarklet.js
Created July 5, 2013 03:44
Responsive bookmarklets
javascript:document.write(%27<!DOCTYPE html><html><head><meta charset%3D"utf-8"><title>Responsive Design Testing</title><style>body %7B margin: 20px%3B font-family: sans-serif%3B overflow-x: scroll%3B %7D.wrapper %7B width: 6000px%3B %7D.frame %7B float: left%3B %7Dh2 %7B margin: 0 0 5px 0%3B %7Diframe %7B margin: 0 20px 20px 0%3B border: 1px solid %23666%3B %7D</style></head><body><div class%3D"wrapper"><div class%3D"frame"><h2>320<span> x 480</span> <small>(mobile)</small></h2><iframe src%3D"%27 %2B window.location %2B %27" sandbox%3D"allow-scripts allow-same-origin allow-forms" seamless width%3D"320" height%3D"480"></iframe></div><div class%3D"frame"><h2>480<span> x 640</span> <small>(small tablet)</small></h2><iframe src%3D"%27 %2B window.location %2B %27" sandbox%3D"allow-scripts allow-same-origin allow-forms" seamless width%3D"480" height%3D"640"></iframe></div><div class%3D"frame"><h2>768<span> x 1024</span> <small>(tablet - portrait)</small></h2><iframe src%3D"%27 %2B window.location %2B %27" sandbox%
@paulmars
paulmars / gist:6099747
Created July 28, 2013 19:16
How to delete a large directory in Unix (i need this every 6-12 months). Replace 'mydir' with location.
find mydir -type f | while read -r; do rm -v "$REPLY"; sleep 0.2; done