Skip to content

Instantly share code, notes, and snippets.

Hannes Probst hc2p

Block or report user

Report or block hc2p

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@innovia
innovia / kubernetes_add_service_account_kubeconfig.sh
Last active Feb 14, 2020
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
View kubernetes_add_service_account_kubeconfig.sh
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@lopis
lopis / berlin-terminator.user.js
Last active Jun 3, 2016
Script that automates hunting for a new Termin in Berlin https://redd.it/3v0op4
View berlin-terminator.user.js
// ==UserScript==
// @name Terminator
// @namespace https://service.berlin.de/terminvereinbarung/termin/*
// @description Automates find an apointment in Berlin's website
// @include https://service.berlin.de/terminvereinbarung/termin/*
// @version 1
// @grant none
// @require http://code.jquery.com/jquery-2.1.4.min.js
@harley
harley / rake_benchmark.rb
Created Jul 14, 2012
Benchmarking a rake task
View rake_benchmark.rb
# Put this in Rakefile (doesn't matter where)
require 'benchmark'
class Rake::Task
def execute_with_benchmark(*args)
bm = Benchmark.measure { execute_without_benchmark(*args) }
puts " #{name} --> #{bm}"
end
alias_method :execute_without_benchmark, :execute
@twetzel
twetzel / partial_helper.js.coffee
Created Jun 21, 2012
.eco - Partials .. Render Partials in .jst.eco templates (for Rails + Spine / maybe Backbone)
View partial_helper.js.coffee
# Render Partials in ECO-Templates like in Rails-ERB
#
# usefull to clean up structure in spine.js and other js-mvc´s like backbone
#
# usage:
# <%- render_partial 'path/to/partial' %> .. will render ../spine-app/views/path/to/_partial.jst.eco
# <%- render_partial 'path/to/partial', foo: 'bar' %> .. will render ../spine-app/views/path/to/_partial.jst.eco .. locals = @foo
#
window.render_partial = ( path, options = {} ) ->
# add the leading underscore (like rails-partials)
@geddski
geddski / nesting.js
Created Jan 14, 2012
helper function for nesting backbone collections.
View nesting.js
function nestCollection(model, attributeName, nestedCollection) {
//setup nested references
for (var i = 0; i < nestedCollection.length; i++) {
model.attributes[attributeName][i] = nestedCollection.at(i).attributes;
}
//create empty arrays if none
nestedCollection.bind('add', function (initiative) {
if (!model.get(attributeName)) {
model.attributes[attributeName] = [];
You can’t perform that action at this time.