Skip to content

Instantly share code, notes, and snippets.

View doon's full-sized avatar
💭
Head Desking....

Patrick Muldoon doon

💭
Head Desking....
View GitHub Profile

Keybase proof

I hereby claim:

  • I am doon on github.
  • I am doon (https://keybase.io/doon) on keybase.
  • I have a public key ASDk4h8-z6zz9760y8VtiUf3X3ukzbLhZsiDi6NFHtNN_Qo

To claim this, I am signing this object:

@doon
doon / postgres_domain_bug.rb:
Last active August 29, 2015 14:02
rails bug searching by postgresql domain type
#!/usr/bin/env ruby
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.1.2rc1'
gem 'pg'
GEMFILE
system 'bundle'

Keybase proof

I hereby claim:

  • I am doon on github.
  • I am doon (https://keybase.io/doon) on keybase.
  • I have a public key whose fingerprint is C59E 0D27 2CA9 3373 1DC5 BA23 BF44 32B0 2BD7 CDAA

To claim this, I am signing this object:

There was an old lady called Wright
who could travel much faster than light.
She departed one day
in a relative way
and returned on the previous night.
<?php
$vlans = '00 00 00 00 00 00 00 00 00 00 00 80 04 00 00 00';
$v = explode(' ',$vlans);
foreach ($v as $idx=>$o){
if ($o == '00'){
next;
}else{
$base = $idx * 8;
$mask = str_split(str_pad(base_convert($o,16,2),8,'0',STR_PAD_LEFT));
#!/usr/bin/env ruby
vlans = '00 00 00 00 00 00 00 00 00 00 00 80 04 00 00 00'
vlans.split.each_with_index do |o,idx|
next if o == '00'
base = 8 * idx
mask = sprintf('%08b',o.to_i(16))
mask.split("").each_with_index do |x,i|
next if x == '0'
puts base + (i.to_i)