Skip to content

Instantly share code, notes, and snippets.

View 1st8's full-sized avatar

Christoph Geschwind 1st8

View GitHub Profile
@1st8
1st8 / storage.ex
Last active June 5, 2020 12:25
ExAws.S3 put_bucket_notification simple implementation (minio enable webhooks)
defmodule MyApp.Storage do
def enable_notifications(bucket) do
body = """
<NotificationConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<QueueConfiguration>
<Id>opencake</Id>
<Queue>arn:minio:sqs::_:webhook</Queue>
<Event>s3:ObjectCreated:*</Event>
<Event>s3:ObjectRemoved:*</Event>
</QueueConfiguration>
@1st8
1st8 / factorio_blueprint.rb
Last active July 14, 2017 07:30
Factorio blueprint parsing with ruby
require 'base64'
require 'zlib'
require 'json'
# Sample blueprint, one burner mining drill and one stone furnace
blueprint = "0eNqF0N0KwjAMBeB3yXU7ZtkG9lVEZD9xBLpstJ04Rt/ddiIMRb1rCufrSVdozIyTJfagV6B2ZAf6tIKjnmuT7vwyIWggjwMI4HpIUzNbRisHYuJedpaMgSCAuMM76EMQfwXnR0Z5jU7d4i6rwlkAsidP+KyyDcuF56FBG/EvhIBpdDE1cnozSjLPSgFLPByyMqRKb5L6uc6H9+LypMWS2z5694ECbmjdFqiKQhXHXFVlFcIDjTN2Tg=="
# @param [String] blueprint
# @return [Hash]
def blueprint_to_hash(blueprint)
@1st8
1st8 / gist:9112541
Last active August 29, 2015 13:56 — forked from schacon/gist:942899
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v develop |
grep -v release |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@1st8
1st8 / gist:3128135
Created July 17, 2012 08:47
God process monitoring + Upstart + rbenv
description "God Process Monitoring"
author "Christoph Geschwind <[email protected]>"
start on runlevel [2345]
stop on runlevel [!2345]
respawn # respawn the service if it dies
respawn limit 5 10 # stop respawning if it fails 5 times in 10 seconds
pre-start script