Skip to content

Instantly share code, notes, and snippets.

View seanhandley's full-sized avatar
🧀
Eating cheese

Sean Handley seanhandley

🧀
Eating cheese
View GitHub Profile
@seanhandley
seanhandley / pi_info.sh
Last active July 16, 2019 06:12
Display Info About Raspberry Pi
# Cheers to the original author https://www.raspberrypi.org/forums/viewtopic.php?t=23440
function pi_info_uptime() {
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
let hours=$((${upSeconds}/3600%24))
let days=$((${upSeconds}/86400))
printf "%d days, %d hours, %d minutes, %d seconds" "$days" "$hours" "$mins" "$secs"
}
0.0.0.0 r4.sn-cxaaj5o5q5-tt16.googlevideo.com
0.0.0.0 r3.sn-q5u5bgv02-3c26.googlevideo.com
0.0.0.0 r12.sn-bvvbax-hn26.googlevideo.com
0.0.0.0 r7.sn-w5nuxa-o536.googlevideo.com
0.0.0.0 r1.sn-4g5e6n76.googlevideo.com
0.0.0.0 r3.sn-4g5e6n76.googlevideo.com
0.0.0.0 r4.sn-4g5e6n76.googlevideo.com
0.0.0.0 r5.sn-4g5e6n76.googlevideo.com
0.0.0.0 r6.sn-4g5e6n76.googlevideo.com
0.0.0.0 r1.sn-nx5e6n76.googlevideo.com
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)
typedef :ulong_long, :h3_index

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 April 9, 2024 04:05
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@seanhandley
seanhandley / lb.rb
Created August 26, 2017 13:35
Build a load balancer with Fog
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 September 20, 2017 14:45
FizzBuzz in Elixir / The Magic of Functional Pattern Matching
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"
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 February 15, 2017 11:19
Using Redis Auth with ActionCable
default: &default
adapter: redis
url: redis://localhost:6379/1
development:
<<: *default
test:
<<: *default