Skip to content

Instantly share code, notes, and snippets.

View scarybot's full-sized avatar
🤖

James Denness scarybot

🤖
View GitHub Profile
@scarybot
scarybot / role-trust-policy.json
Created January 22, 2020 14:12
Role trust policy for multi-account model
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::(your account number):root"
},
"Action": "sts:AssumeRole",
"Condition": {
@scarybot
scarybot / group-policy.json
Created January 22, 2020 14:11
Group assume-role policy for multi-account model
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": [
"arn:aws:iam::*:role/(role name)",
]
@scarybot
scarybot / config
Created January 22, 2020 14:09
Sample AWS config file for multi-account model
# Master profile
[profile master]
aws_access_key_id = (access key id)
aws_secret_access_key = (secret access key)
region = eu-west-1
# Slave profiles
[profile development]
@scarybot
scarybot / get_ssh_auth_methods.rb
Last active September 19, 2019 07:42
Get a list of allowed SSH auth methods (for Ryan)
require 'net/ssh'
transport_session = Net::SSH::Transport::Session.new('ryans-server.com')
transport_session.send_message(transport_session.service_request("ssh-userauth"))
auth_session = Net::SSH::Authentication::Session.new(transport_session)
auth_session.expect_message(Net::SSH::Transport::Constants::SERVICE_ACCEPT)
transport_session.send_message(Net::SSH::Authentication::Methods::Publickey.new(transport_session).userauth_request(false, false, false))
allowed_auth_methods = transport_session.next_message.instance_variable_get('@named_elements')[:authentications].split(',')
puts allowed_auth_methods.inspect
# The game board layout, consisting of an array of Squares.
BOARD = [
Square.new(
name: 'GO',
action: Proc.new { |game, owner, player, property|
Transaction.new(from: game.bank, to: player, reason: 'landing on go', amount: game.go_amount)
}
),
BasicProperty.new(
@scarybot
scarybot / HUI_detect_record_MIDI.txt
Created September 19, 2016 07:31
Detect when a MIDI or HUI capable device enters and leaves record mode
In order to detect the Record punch-in and punch-out sequences:
Add an HUI control service (HUI-partial in Reaper) and assign it to your MIDI output.
Watch for the following Control change sequences on channel 1:
Record start (punch-in):
Pitch: 2C (dec 44), Velocity: 45 (dec 69)
Record stop (punch-out):
Pitch: 2C (dec 44), Velocity: 5 (dec 5)