Skip to content

Instantly share code, notes, and snippets.

🍭
I am a meat popsicle

Sean Handley seanhandley

View GitHub Profile
View data.rb
module H3
class Resolution
extend FFI::DataConverter
native_type FFI::Type::INT
RES_RANGE = 0..15
class << self
def to_native(value, _context)
failure unless value.is_a?(Integer) && RES_RANGE.cover?(value)
View typedef.rb
typedef :ulong_long, :h3_index
View smoky_red_pepper_chicken.md

Smoky Red Pepper Chicken

Feeds 4.

Goes beautifully with green beans and rice or new potatoes.

Ingredients

  • 3 x Chicken breast fillets
  • 200ml Double cream
@seanhandley
seanhandley / docker-compose.yml
Last active Apr 23, 2019
How To Set Up Docker For Mac with Native NFS
View docker-compose.yml
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@seanhandley
seanhandley / lb.rb
Created Aug 26, 2017
Build a load balancer with Fog
View lb.rb
require 'fog/openstack'
conn = {
openstack_auth_url: ENV["OS_AUTH_URL"],
openstack_username: ENV["OS_USERNAME"],
openstack_api_key: ENV["OS_PASSWORD"],
openstack_project_name: ENV["OS_PROJECT_NAME"],
openstack_domain_id: ENV["OS_USER_DOMAIN_NAME"]
}
@seanhandley
seanhandley / fizzbuzz.ex
Last active Sep 20, 2017
FizzBuzz in Elixir / The Magic of Functional Pattern Matching
View fizzbuzz.ex
fb = fn
0, 0, _ -> "FizzBuzz"
0, _, _ -> "Fizz"
_, 0, _ -> "Buzz"
_, _, x -> x
end
fizzbuzz = fn (n) -> fb.(rem(n, 3), rem(n, 5), n) end
fizzbuzz.(10) # => "Buzz"
View custom_attributes.rb
module CustomAttributes
def attributes(*attrs)
attrs.each do |sym|
define_method sym do
instance_variable_get("@#{sym}")
end
define_method :"#{sym}=" do |v|
instance_variable_set("@#{sym}", v)
end
end
@seanhandley
seanhandley / cable.yml
Created Feb 15, 2017
Using Redis Auth with ActionCable
View cable.yml
default: &default
adapter: redis
url: redis://localhost:6379/1
development:
<<: *default
test:
<<: *default
View magnum3.sh
magnum cluster-show k8s-cluster
+--------------------+------------------------------------------------------------+
| Property | Value |
+--------------------+------------------------------------------------------------+
| status | CREATE_COMPLETE |
| uuid | cff82cd0-189c-4ede-a9cb-2c0af6997709 |
| stack_id | 7947844a-8e18-4c79-b591-ecf0f6067641 |
| status_reason | Stack CREATE completed successfully |
| created_at | 2016-05-26T17:45:57+00:00 |
@seanhandley
seanhandley / magnum2.sh
Last active Dec 9, 2016
Magnum from scratch
View magnum2.sh
# You'll need a container OS like Fedora Atomic first
wget https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2
openstack image create fedora-atomic-latest --disk-format "qcow2" --public \
--container-format 'bare' \
--file 'fedora-atomic-latest.qcow2' \
--property os_distro=fedora-atomic
# Use your own keypair name in place of 'kp'
magnum cluster-template-create --name='k8s-cluster-template' --image-id='fedora-atomic-latest' \
--keypair-id='kp' --external-network-id='public' --master-flavor-id='m1.small' \
You can’t perform that action at this time.