Skip to content

Instantly share code, notes, and snippets.

@rnelson
rnelson / directorysizes.sh
Created December 17, 2010 17:13
Aliases to find directory sizes
alias ds="find -maxdepth 1 -type d -path '.\/*' -exec du -sh {} \;"
alias sds="sudo find -maxdepth 1 -type d -path '.\/*' -exec du -sh {} \;"
alias dsg="find -maxdepth 1 -type d -path '.\/*' -exec du -sh {} \; | grep "
alias sdsg="sudo find -maxdepth 1 -type d -path '.\/*' -exec du -sh {} \; | grep "
@rnelson
rnelson / less-style.css
Created August 1, 2011 18:41
My configs for basic LessServlet usage
/* the following is the result of viewing /css/style.css (which runs through LessServlet) */
body{background:#9de;color:black;}
@rnelson
rnelson / mkbigfile.py
Created October 4, 2011 13:49
Make a big file
#!/usr/bin/env python
# Based on http://stackoverflow.com/questions/982659/quickly-create-large-file-on-a-windows-system
import os
import sys
if len(sys.argv) != 3:
print 'usage: mkbigfile.py <filename> <size in gb>'
sys.exit(1)
# Grab the filename and requested size, convert the size to bytes
@rnelson
rnelson / NetworkTest.scpt
Created November 2, 2011 19:34
Test for a working network connection
set testHost to "google.com"
set errorSubject to "Internet Died"
set errorRecipientName to "Your Name"
set errorRecipientAddress to "your@ddr.ess"
set audioFile to "Macintosh HD:Users:rnelson:Music:iTunes:iTunes Music:Bad Religion:The Process of Belief:04 Broken.mp3" -- Broken, just like my internet
repeat
-- Try to use the network
set command to "/usr/sbin/scutil -r " & testHost
@rnelson
rnelson / in.rdf
Created February 23, 2012 19:20
Steve's Problem #1894467
#!/usr/bin/env ruby
require 'rexml/document'
# Open in.rdf and parse it as XML
xml = REXML::Document.new File.new('in.rdf')
# Go through every <rdf:Description> tag
xml.elements.each('//rdf:Description') do | description |
# Go through every <find> tag underneath the <rdf:Description>
# that we're currently looking at
@rnelson
rnelson / mkbigfile.py
Created April 18, 2012 17:14
Makes a big file.
#!/usr/bin/env python
# Based on http://stackoverflow.com/questions/982659/quickly-create-large-file-on-a-windows-system
import os
import sys
if len(sys.argv) != 3:
print 'usage: mkbigfile.py <filename> <size in gb>'
sys.exit(1)
# Grab the filename and requested size, convert the size to bytes
@rnelson
rnelson / mkbigfile.c
Created April 18, 2012 21:44
Makes a big file.
#include <sys/stat.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
void usage();
@rnelson
rnelson / mkbigfile.rb
Created April 19, 2012 15:44
Makes a big file.
#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
require 'pp'
class MkBigFile
attr_reader :name, :version, :options
TYPES = %w[zero sparse]
def initialize()
@rnelson
rnelson / buildall.bat
Created July 31, 2012 13:32
VB batch build via MSBuild
@ECHO OFF
REM Make sure to set up those platforms under Build > Configuration Manager before
REM running this.
set PROJFILE=MyAwesomeApp.sln
msbuild %PROJFILE% /nologo /t:Rebuild /p:Configuration=Debug;Platform=x86;RunCodeAnalysis=False
msbuild %PROJFILE% /nologo /t:Rebuild /p:Configuration=Release;Platform=x86;RunCodeAnalysis=False
msbuild %PROJFILE% /nologo /t:Rebuild /p:Configuration=Debug;Platform=x64;RunCodeAnalysis=False
msbuild %PROJFILE% /nologo /t:Rebuild /p:Configuration=Release;Platform=x64;RunCodeAnalysis=False
@rnelson
rnelson / newnetbsd.sh
Last active September 1, 2020 08:33
Script to set up a NetBSD install to my liking
#!/bin/sh
#
# newnetbsd.sh - set up a fresh NetBSD install
#
# Prereq:
# - During install:
# - Configure your network
# - Install pkgin ("Enable installation of binary packages")
# - Fetch/unpack pkgsrc
# - Run ntpdate at boot