Skip to content

Instantly share code, notes, and snippets.

View kalvir-sandhu's full-sized avatar

Kalv Sandhu kalvir-sandhu

View GitHub Profile
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
@kalvir-sandhu
kalvir-sandhu / gist:7147336
Last active December 26, 2015 11:59
A list of links, patches and articles to help with Mavericks os x for ruby development
@kalvir-sandhu
kalvir-sandhu / gist:4717116
Created February 5, 2013 19:55
Big decimal is ok
>> require 'bigdecimal'
=> true
>> BigDecimal.new(0.75,2)
=> #<BigDecimal:7fc6fc0f2330,'0.75E0',9(36)>
>> _.to_f
=> 0.75
>> RUBY_VERSION
=> "1.9.3"
>> RUBY_DESCRIPTION
=> "ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.2.0]"
@kalvir-sandhu
kalvir-sandhu / My output
Created December 11, 2012 19:12
What is going on here?
$ ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.2.0]
$ ruby test_time.rb
Parsing the timestamp 2012-12-11 18:01:54.246524000
The float compare to string formatted output: false
"1355277714.2465239"
"1355277714.246524"
@kalvir-sandhu
kalvir-sandhu / gist:1391982
Created November 24, 2011 18:32
How to turn off skype automatic gain
cd ~/Library/Application\ Support/Skype
ruby -e 'puts File.read("shared.xml").to_s.gsub("<VoiceEng>","<VoiceEng>\n<AGC>0</AGC>\n<EC>0</EC>")' > new_shared.xml
mv shared.xml shared.xml.bak
mv new_shared.xml shared.xml
@kalvir-sandhu
kalvir-sandhu / vim7.3_mac_install.rb
Created October 13, 2011 19:14 — forked from sirupsen/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end
@kalvir-sandhu
kalvir-sandhu / gist:913392
Created April 11, 2011 11:49
Clear out Resque messages that have Decode errors.
# Use from console, was required as old messages were incorrectly encoded and placed on the failed queue
# preventing us to view the failed queue.
include Resque::Helpers
Resque::Failure.count.times do |index|
puts "Checking #{index}"
begin
decode Resque.redis.lindex(:failed, index)
rescue Resque::Helpers::DecodeException
@kalvir-sandhu
kalvir-sandhu / hex_play.rb
Created February 15, 2011 14:23
Playing with hex and characters
raw_data = <<-EOF
0000 0048 0000 0005 0000 0000 0000 0092
0001 0134 3437 3739 3935 3734 3435 3200
0101 3434 3739 3835 3133 3937 3331 0000
0000 0000 0000 0000 0f41 626f 7574 20bb
3435 302c 3030 303f
EOF
raw_data = <<-EOF
0001 0134 3437 3739 3935 3734 3435 3200
@kalvir-sandhu
kalvir-sandhu / Gemfile
Created February 14, 2011 18:11
Errors containing invalid UTF8 appear to break getexceptional (i.e. they don't appear in the interface)
source :rubygems
gem 'exceptional'
gem 'json'
@kalvir-sandhu
kalvir-sandhu / gist:822337
Created February 11, 2011 13:29
O2 Broadband router changes

O2 Broadband router changes

These are the changes that i did to the router. Obviously some assumptions made here but last week the changes made a difference, I think resetting the box yesterday lost the changes.

Wanting to improve the wifi as at the moment believe the adsl is good but the box is crap at wifi and juggling everything else it needs to do.

Via the web interface

  • When logged in, click on wireless, then select configure from the top right and then do this:
  • Power reduction enabled should be disabled (We want the box to dedicate