I hereby claim:
- I am vitiman on github.
- I am vitiman (https://keybase.io/vitiman) on keybase.
- I have a public key whose fingerprint is 1509 C29C 34BF A349 D33C 4BF5 00A9 75A0 96BE E609
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# python imports | |
import datetime | |
RANGE_TIME = 15 | |
def date_range_iterator(start_date, end_date, delta=None): | |
""" Iterator for date ranges, given an start_date, end_date and an | |
optional delta (the range) |
var requests = []; | |
Object.keys(sources).forEach(function(key){ | |
requests.push(someAjaxAsyncRequest(arguments)); | |
}); | |
$.when.apply($, requests).done(function() { | |
console.log(arguments); | |
$.each(arguments, function (i, data) { | |
// By method | |
console.log(data); | |
}); |
========================================== ========================================== | |
TMUX COMMAND WINDOW (TAB) | |
========================================== ========================================== | |
List tmux ls List ^b w | |
New -s <session> Create ^b c | |
Attach att -t <session> Rename ^b , <name> | |
Rename rename-session -t <old> <new> Last ^b l (lower-L) | |
Kill kill-session -t <session> Close ^b & |
Requirements:
Repository setup (without anonymous access):
# Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect | |
# [email protected] - http://jeroen.massar.ch | |
server { | |
listen 192.0.1.1:80; | |
listen [2001:db8::1]:80; | |
# Redirect all non-HTTPS traffic to the HTTPS variant | |
return 301 https://$host$request_uri; | |
} |
from itertools import chain, islice, zip_longest | |
# izip_longest in python2 | |
def grouper(iterable, n, fillvalue=None): | |
""" | |
# https://stackoverflow.com/a/434411 | |
>>> aaa = [1, 2, 3, 5, 6, 1, 3, 4, 8, 2094283, 123] | |
>>> [_ for _ in grouper(aaa, 3)] | |
[(1, 2, 3), (5, 6, 1), (3, 4, 8), (2094283, 123, None)] |
def download_file(): | |
""" | |
http://code.runnable.com/UiIdhKohv5JQAAB6/how-to-download-a-file-generated-on-the-fly-in-flask-for-python | |
""" | |
... | |
some_text = "" | |
filename = "FILENAME" | |
response = make_response(some_text, 200) | |
response.content_type = "text/plain" | |
response.headers[ |
def reaching_max_messages(current_hour_bitrange): | |
""" | |
from https://stackoverflow.com/a/29281409 | |
""" | |
# https://stackoverflow.com/a/29281409 | |
# https://docs.mongodb.com/manual/reference/operator/query/bitsAllSet/ | |
pipeline = [ | |
{ |
import random | |
import string | |
def _random_string(N, chars=string.ascii_uppercase + string.digits): | |
""" To generate values from a set of chars and a given length | |
""" | |
return ''.join(random.choice(chars) for _ in range(N)) |