Skip to content

Instantly share code, notes, and snippets.

View mkhl's full-sized avatar
🖤
…at any cost

Martin Kühl mkhl

🖤
…at any cost
View GitHub Profile
@mkhl
mkhl / wait-for.sh
Last active April 23, 2021 09:57 — forked from michael-simons/wait_for_bolt.sh
A bash script waiting for port some host and port to become available without netcat or similar
#!/usr/bin/env bash
host=${1:?missing host}
port=${2:?missing port}
timeout=${3:-180}
until (exec 3<>"/dev/tcp/$host/$port") &>/dev/null; do
((timeout == 0)) && exit 1
((timeout--))
echo -n .
sleep 1
done
@mkhl
mkhl / README.md
Last active November 2, 2017 10:42 — forked from FND/README.md
complate-wsgi sandbox
$ python3 -m venv venv
$ . venv/bin/activate

$ pip install js2py gunicorn

$ gunicorn app:app

http://localhost:8000

@mkhl
mkhl / cdup.sh
Created December 13, 2011 22:19 — forked from ieure/cdup.sh
function cdup {
local dir=$PWD
local target=${*:-.git}
until [ -e "$dir/$target" -o "$dir" = "/" ]; do
dir="$(dirname "$dir")"
done
test -e "$dir/$target" && cd "$dir"
}
function catup {
//
// NSObject+BlockObservation.h
// Version 1.0
//
// Andy Matuschak
// andy@andymatuschak.org
// Public domain because I love you. Let me know how you use it.
//
#import <Cocoa/Cocoa.h>
//
// NSApplication+DockIcon.m
// Hyperspaces
//
// Created by Tony Arnold on 30/06/09.
// Licensed under Creative Commons Attribution 2.5 - http://creativecommons.org/licenses/by/2.5/
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
require 'net/http'
require 'uri'
# /api/v1/:format/new
# /api/v1/:format/gists/:user
# /api/v1/:format/:gist_id
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'),
{ 'files[file1.ab]' => 'CONTNETS',
'files[file2.ab]' => 'contents' })
@mkhl
mkhl / bypass.rb
Created November 23, 2008 14:43 — forked from mojombo/Glavni program
Bypass encapsulation to test private methods (Ruby)
# This allows you to be a good OOP citizen and honor encapsulation, but
# still make calls to private methods (for testing) by doing
#
# obj.bypass.private_thingie(arg1, arg2)
#
# Which is easier on the eye than
#
# obj.send(:private_thingie, arg1, arg2)
#
class Object