$ python3 -m venv venv
$ . venv/bin/activate
$ pip install js2py gunicorn
$ gunicorn app:app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSObject+BlockObservation.h | |
// Version 1.0 | |
// | |
// Andy Matuschak | |
// [email protected] | |
// Public domain because I love you. Let me know how you use it. | |
// | |
#import <Cocoa/Cocoa.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |