Skip to content

Instantly share code, notes, and snippets.

View Overbryd's full-sized avatar

Lukas Rieder Overbryd

View GitHub Profile
@jhovell
jhovell / EcsBurstBalance.json
Created February 1, 2017 21:52
ECS BurstBalance monitoring, alerting and healthcheck
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Alerts on ECS burst balance and terminates unhealthy hosts",
"Parameters" : {
"ClusterName": {
"Type": "String",
"Description": "ECS Cluster name"
},
@so0k
so0k / kubectl.md
Last active April 25, 2024 12:40
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@samgiles
samgiles / flatMap.js
Created June 20, 2014 11:32
Javascript flatMap implementation
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
@jazzido
jazzido / nanodw.rb
Last active October 21, 2015 17:58
A Nano datawarehouse-like datastore
# coding: utf-8
require 'sequel'
require 'logger'
module NanoDW
Sequel.datetime_class = DateTime
DB = Sequel.connect(ENV['DATABASE_URL'])
log = Logger.new(STDERR)
log.progname = 'NanoDW::Models'
@glebm
glebm / async_emails_i18n.rb
Last active August 8, 2017 09:42
Inject locale into Resque::Mailer and Devise::Async
require 'resque_mailer'
require 'devise/async'
# pop and set locale from the args before running
module PerformWithLocale
def perform(*args)
I18n.with_locale(args.pop) do
super(*args)
end
end
@moxley
moxley / my_class.rb
Created September 20, 2012 00:13
Weird Ruby Behavior
class MyClass
def value
"VALUE!"
end
def do_something
puts value # Outputs "VALUE!"
if false
value = nil # Should not execute
end
@rweald
rweald / spoof_mac_address.rb
Created August 27, 2012 17:20
Little Ruby script to spoof a mac address
#!/usr/bin/env ruby
puts "Please Enter Your MAC Address: "
mac = gets
mac = mac.strip
`sudo /bin/bash -lc "sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z && sudo ifconfig en0 ether #{mac}"`
puts "Congratulations you now have #{mac} as your MAC address"
@netmute
netmute / README.md
Last active October 27, 2022 13:22
Game of Life

Game of Life

An implementation of Conway's Game of Life in 140 characters of Ruby.

Author

Created by Simon Ernst (@sier).

@wdalmut
wdalmut / git-remove-forever.sh
Created January 14, 2012 09:46
Remove files or folders from git history forever!
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0
@rtomayko
rtomayko / optparse-template.rb
Last active June 3, 2023 03:16
Ruby optparse template
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"