Skip to content

Instantly share code, notes, and snippets.

@kwoods
kwoods / installing_rails_322_on_mac_os_x_lion
Created March 20, 2012 15:22
Installing Ruby on Rails 3.2.3 for Mac OS X 10.7.3 Lion
# This is a guide for how I installed rails 3.2.2 on Mac OS X 10.7.3 Lion upgrade.
# There is no Warranty expressed, and I am not responsible for any issues that may arise from following this guide.
# - inspired by tuscanidream
# Install RVM
$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
# Add the following line to your .bash_profile to load RVM into your new shells
[[ -s "/Users/my_user_name/.rvm/scripts/rvm" ]] && source "/Users/my_user_name/.rvm/scripts/rvm" # This loads RVM into a shell session.
@kwoods
kwoods / grouptext-sample.php
Created April 4, 2012 19:29
Grouptexting Sample
<?php
$data = array(
'User' => 'user',
'Password' => 'pass',
'PhoneNumbers' => array('1234567890'),
'Subject' => 'subject',
'Message' => 'message'
);
@kwoods
kwoods / gist:3307927
Created August 9, 2012 20:49
Radio Button FF Fix
<fieldset><span class="default">Customizable?
<input type="radio" name="customizable" id="cust_y" value="Yes" action="open#custom" />
<label for="cust_y" class="default">Yes</label>
<input type="radio" name="customizable" id="cust_n" value="No" action="open#normal" />
<label for="cust_n" class="default">No</label></span>
</fieldset>
@kwoods
kwoods / ad_computer_name_search.rb
Created September 18, 2012 13:09
Search for Computer Names using List of Users
# This script will take a list of user names
# formatted like so: Amos, Deborah K
# and convert the name into LastnameFirstInitial
# to use for searching Active Directory for
# matching computer names...
require 'net-ldap'
@ldap = Net::LDAP.new :host => "ip-addr-of-dc",
@kwoods
kwoods / hex_darken.rb
Created January 25, 2014 03:11
Lower brightness for a given CSS hex value, used for gradients
# Reduces a color's brightness by a percentage
# returns a hex value in the format "#x0x0x0"
def self.darken(hex,percent)
# convert to r,g,b
rgb_version = hex.to_s.gsub("#","").scan(/../).map {|color| color.to_i(16)}
# reduce values by 'percent'
new_rgb_color = rgb_version.map {|rgb| (rgb - (rgb * percent.to_f/100)).ceil}
#!/usr/bin/env ruby
# encoding: utf-8
# By Uğur Özyılmazel, @vigobronx | @ugurozyilmazel
# http://vigodome.com | http://ugur.ozyilmazel.com | http://github.com/vigo
def get_paged_memory_usage(match_string, paging=4096)
mvar = 3
if match_string.split(/[^\w]/).length > 1
mvar = 4
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@kwoods
kwoods / Makefile
Created November 17, 2015 20:23 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@kwoods
kwoods / batcharge.py
Created March 18, 2016 18:06 — forked from remy/batcharge.py
My zsh set up as of July 25, 2013
#!/usr/bin/env python
# saved to ~/bin/batcharge.py and from
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity
#!/usr/bin/env python
# coding=UTF-8
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]