Skip to content

Instantly share code, notes, and snippets.

@codeinthehole
codeinthehole / docker-osx-shared-folders.rst
Last active November 11, 2023 01:22
How to share folders with docker containers on OSX

How to share a folder with a docker container on OSX

Mounting shared folders between OSX and the docker container is tricky due to the intermediate boot2docker VM. You can't use the usual docker -v option as the docker server knows nothing about the OSX filesystem - it can only mount folders from the boot2docker filesystem. Fortunately, you can work around this using SSHFS.

@codekitchen
codekitchen / cassandra_key_to_token.rb
Created October 3, 2013 15:37
convert a key to cassandra token in the style of RandomPartitioner
require 'digest/md5'
digest = Digest::MD5.hexdigest(ARGV[0])
token = digest.to_i(16)
token = token - (1 << bits) if (token & (1 << (bits - 1))) != 0
puts token.abs
@codekitchen
codekitchen / env.sh
Last active December 12, 2015 12:49
example of querying cassandra page views with pig
export PIG_HOME=/usr/local/Cellar/pig/0.10.0
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
export PIG_INITIAL_ADDRESS=localhost
export PIG_RPC_PORT=9160
export PIG_PARTITIONER=org.apache.cassandra.dht.RandomPartitioner
bin/pig_cassandra -x local
@codekitchen
codekitchen / faraday-canvas.rb
Created January 16, 2012 23:37
talking to canvas with faraday-stack
require 'faraday_stack'
conn = FaradayStack.build 'https://canvas.beta.instructure.com/'
conn.headers[:authorization] = "Bearer #{api_token}"
resp = conn.get '/api/v1/courses?include[]=syllabus_body'
puts("%-50s %s" % ['course name', 'enrollment'])
resp.body.each do |course|
puts("%-50s %s" % [course['name'], course['enrollments'].first['type']])