Skip to content

Instantly share code, notes, and snippets.

View seanhandley's full-sized avatar
👋

Sean Handley seanhandley

👋
View GitHub Profile
SESSION=`curl -s -L -I http://raspberrypi:9091/transmission/web | grep X-Transmission-Session-Id | cut -d' ' -f 2 | sed 's/[[:space:]]*$//'`
curl 'http://raspberrypi:9091/transmission/rpc' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9,fr;q=0.8,ru;q=0.7' -H "X-Transmission-Session-Id: `echo $SESSION`" -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Content-Type: json' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: http://raspberrypi:9091/transmission/web/' -H 'DNT: 1' --data-binary '{"method":"torrent-add","arguments":{"paused":false,"download-dir":"/mnt/sda1/New","filename":"'"${URL}"'"}}' --compressed --insecure
@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 January 23, 2025 09:49
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