Skip to content

Instantly share code, notes, and snippets.

@RobertAudi
RobertAudi / tasks.rb
Created November 17, 2011 04:38
Something I hacked in an hour tonight. Disgusting code but useful output.
#!/usr/bin/env ruby
# encoding: utf-8
COLORS_ENABLED = TRUE
VALID_TASKS = {
"TODO" => /TODO[\s,:]+(\S.*)$/,
"FIXME" => /FIX ?ME[\s,:]+(\S.*)$/,
"CHANGED" => /CHANGED[\s,:]+(\S.*)$/,
"NOTE" => /NOTE[\s,:]+(\S.*)$/
class String
def humanize
self.split(/[-_]/).map {|w| w.capitalize }.join(' ')
end
end
@RobertAudi
RobertAudi / C.rb
Created March 11, 2011 18:36 — forked from ox/C.rb
#!/usr/bin/env ruby
# Version (0.79)
# Created by Artem Titoulenko ([email protected])
# clock in application. I'm tired of counting.
# C.rb -- Time keeping script.
# Call with no params to clock in/out
# Params:
# ? : are you clocked in? check
# log : peek at the work log
@RobertAudi
RobertAudi / gist:840197
Created February 23, 2011 09:03
Vim OS Check
" -OS-Check---------------------------------------------------------------------
function! MySys()
if has("win32")
return "win32"
elseif has("mac") || has("macunix")
return "mac"
elseif has("unix")
return "unix"
else
return "unix"
@RobertAudi
RobertAudi / .rvmrc
Created February 15, 2011 22:42 — forked from wayneeseguin/0_notes.txt
RVM Project Environment done the right way
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.2-p136"
#
# First we attempt to load the desired environment directly from the environment
@RobertAudi
RobertAudi / please.rb
Created December 2, 2010 12:50
`pmset schedule` wrapper to easily schedule OS X to sleep, shutdown, etc
#!/usr/bin/env ruby
# NOTES:
# - This script only works on OS X.
# - This script was only tested with ruby 1.9.2 using
# the aaronh-chronic gem. If the chronic gem is used
# instead, this script will not work (unless the chronic
# gem was updated to work with ruby 1.9.2).
require 'rubygems'
@RobertAudi
RobertAudi / removexattr.c
Created November 27, 2010 15:28
Little script to make all the files under a certain directory safe on OS X.
/***********************************************************************
* Little script to make all the files under a certain directory safe. *
* Works only on Mac OS X. Tested on 10.5 and 10.6 *
* *
* Written by bojo (Bo Johansson) in a comment on Mac OS X Hint: *
* http://hints.macworld.com/article.php?story=20071029151619619 *
***********************************************************************/
/* Compile by
* gcc -O2 -Wall removexattr.c -o removexattr
@RobertAudi
RobertAudi / m.rb
Created November 3, 2010 16:42
Small wrapper for the mate command
#!/usr/bin/env ruby
# This Script is a wrapper for the mate command.
# IT'S NOT A SUBSTITUTE!
# If you want to pipe to Textmate from the terminal,
# use the mate command instead.
# Also, its slower than the mate command, so if you don't
# mind typing a couple extra characters, but do mind one extra
# second of waiting at most, then use the mate command.
@RobertAudi
RobertAudi / gist:649132
Created October 27, 2010 14:34
Extract one or multiple archives of any type
#!/usr/bin/env ruby
# check if a command exists
def command_exists?(command)
system("which #{command} > /dev/null 2>/dev/null")
$?.exitstatus == 0
end
def usage
usage = "Usage: extract [-vz] <file> [<file> <file> ..]\n\n"
@RobertAudi
RobertAudi / gist:620925
Created October 11, 2010 17:43
Format unix permissions
<?php
/**
* Toggle the formatting of unix permissions between:
* - 0644 OR 755
* - -rw-r--r--
*
* @param string|int $permissions : The permissions string or int that needs to be formatted.
* @param string $is_dir : if true, the first char of the long permissions format will be 'd'. ie: drw-r--r--
* @return string: The formatted permissions.