Skip to content

Instantly share code, notes, and snippets.

@jbrechtel
jbrechtel / subscription_by_queue_arn.sh
Last active April 22, 2022 10:58
goaws SNS -> SQS subscription
#!/bin/sh
echo "CREATING SUBSCRIPTION WITH QUEUE ARN"
set -e
ENDPOINT_URL="http://localhost:4100"
export AWS_DEFAULT_REGION="us-east-1"
export AWS_SECRET_ACCESS_KEY="fakefakefake"
export AWS_ACCESS_KEY_ID="faketyfakefake"
TOPIC_ARN=$(aws --endpoint-url $ENDPOINT_URL sns create-topic --name test-topic | jq -r ".TopicArn")
@jbrechtel
jbrechtel / hack.sh
Created March 31, 2012 19:17 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2267660/hack.sh | sh
#
@jbrechtel
jbrechtel / foo.rb
Created March 4, 2012 15:07
Ruby super
class Foo
def initialize
@something = []
end
end
class SubFoo < Foo
def initialize(things)
super()
@jbrechtel
jbrechtel / composition.js
Last active February 26, 2019 15:59
generators?
function mapComp(array, fn) {
var result = [];
for(var i = 0; i < array.length; i++) {
result.push(fn(i));
}
return result;
}
@jbrechtel
jbrechtel / timezones
Last active September 17, 2018 14:21
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
#!/bin/sh
#pacmd set-default-sink alsa_output.usb-Logitech_Logitech_G933_Gaming_Wireless_Headset-00.analog-stereo
#pacmd set-default-source alsa_input.usb-Logitech_Logitech_G933_Gaming_Wireless_Headset-00.analog-mono
function switchAudio() {
case "$1" in
"logitech")
local sink="alsa_output.usb-Logitech_Logitech_G933_Gaming_Wireless_Headset-00.analog-stereo"
/* utilities */
.pull-left {
float: left;
}
.sr-only {
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
padding: 0 !important;
border: 0 !important;
@jbrechtel
jbrechtel / bikepacking.org
Last active June 28, 2017 18:44
Bikepacking List

Considerations

  • Volume is worse than weight
  • Eat before you’re hungry

Necessary

  • Food (things you can consume quickly and on the bike)
  • Water (more than 2 water bottles. A camelback in a framebag works well here)
  • Shelter with rain fly
@jbrechtel
jbrechtel / game_of_life.markdown
Last active June 19, 2017 01:35
Conway's Game of Life

Conway's Game of Life

Conway's Game of Life is a set of rules which define a cellular automata. Read more about it in Wikipedia. Your task is to write a Conway's Game of Life (GOL) simulation.

GOL consists of a two-dimensional grid of cells. Each cell is either alive or dead. Your simulation should calculate the grid over a user-specified number of generations. To calculate the next generation you apply the following rules to each cell in the grid and the resulting grid is the next generation.

Rules

  • Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  • Any live cell with two or three live neighbours lives on to the next generation.