Skip to content

Instantly share code, notes, and snippets.

View kwoods's full-sized avatar

Kevin Woods kwoods

  • Scotland, UK
  • 17:21 (UTC +01:00)
View GitHub Profile
#!/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
#!/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
@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}
@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 / 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 / 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 / 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.