Skip to content

Instantly share code, notes, and snippets.

View goalaleo's full-sized avatar

Leo Kiiski goalaleo

View GitHub Profile

Change access to public for all files in AWS S3 bucket

Syncing a bucket doesn't seem to copy the access rights for files. This script changes the acl for all objects in the bucket to public-read

require 'aws-sdk'

region_code = 'REGION_CODE_HERE'
aws_access_key = 'ACCESS_KEY_ID_HERE'

Schedule task in Heroku using local time

if [[ $(TZ=Europe/Helsinki date +%H) = 07 ]] ; then echo "Do the thing!" ; else echo "Not 7am" ; fi
@goalaleo
goalaleo / benchmark.txt
Last active May 5, 2019 22:07
Ruby benchmark for String#chars vs String#each_char
Rehearsal --------------------------------------------
option1: 0.711160 0.076554 0.787714 ( 0.796558)
option2: 0.327121 0.003232 0.330353 ( 0.334768)
----------------------------------- total: 1.118067sec
user system total real
option1: 0.718185 0.075168 0.793353 ( 0.802384)
option2: 0.322129 0.001361 0.323490 ( 0.325277)
@goalaleo
goalaleo / resistor_color_duo.rb
Created August 23, 2019 13:51
Benchmark for different approaches to Exercism's ruby track resistor color duo exercise
class ResistorColorDuo
attr_reader :color_bands
COLORS = { 'black' => 0,
'brown' => 1,
'red' => 2,
'orange' => 3,
'yellow' => 4,
'green' => 5,
'blue' => 6,

Keybase proof

I hereby claim:

  • I am goalaleo on github.
  • I am goalaleo (https://keybase.io/goalaleo) on keybase.
  • I have a public key ASAulILAc12XJ8ICksU3Q6aun0n_18Lu0PYRkBf9l68FTgo

To claim this, I am signing this object:

@goalaleo
goalaleo / DefaultKeyBinding.dict
Created August 13, 2020 10:39
Map alt+space (non-breaking space unicode character) to poop emoji. Place this file in ~/Library/KeyBindings/DefaultKeyBinding.dict on Mac OS
{
"~ " = ("insertText:", "💩");
}