Skip to content

Instantly share code, notes, and snippets.

@jess-sol
jess-sol / boot2docker non-standard network CIDRs
Last active April 7, 2016 16:22
Fix 10.0.2.0/24 route collisions with Boot2Docker
# If you have servers on 10.0.2.0/24 you won't be able to reach them from within boot2docker's virtualmachine
# because 10.0.2.0/24 is routed to the host.
# These commands will modify the IP ranges assigned to the docker guest VM so the routes won't collide.
# First Make a NAT Network with CIDR 172.30.101.0/24
# Second verify no Host Only Networks have an IP address of 172.30.100.1
docker-machine rm -f default
docker-machine create -d virtualbox --virtualbox-host-dns-resolver --virtualbox-hostonly-cidr 172.30.100.1/24 default
VBoxManage controlvm default acpipowerbutton
@jess-sol
jess-sol / bogo_sort.rb
Last active March 2, 2016 16:51
Sorts arrays of various sizes using bogo sort (shuffle sort). Compares actual cost with expected cost.
#!/usr/bin/env ruby
class Integer
def factorial
f = 1; for i in 1..self; f *= i; end; f
end
end
def is_sorted?(array)
last = array.first

Keybase proof

I hereby claim:

  • I am ben-rosio on github.
  • I am rben (https://keybase.io/rben) on keybase.
  • I have a public key whose fingerprint is 88B4 B88B FE65 D75F C16A D514 E2FF 8CB5 DAE0 7EFA

To claim this, I am signing this object:

@jess-sol
jess-sol / sass2scss.rb
Last active August 29, 2015 14:01
Transcode all sass files in the current directory to scss files using the amazing sasstoscss.com service
#!/usr/bin/env ruby
require "FileUtils"
require "net/http"
require "uri"
require "json"
url = URI.parse("http://sasstoscss.com/convert")
files = `find "$(pwd)" -name "*.sass"`