Skip to content

Instantly share code, notes, and snippets.

(╯°□°)╯︵ ┻━┻

David Larlet davidbgk

(╯°□°)╯︵ ┻━┻
Block or report user

Report or block davidbgk

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
davidbgk / setup.cfg
Created Dec 17, 2019 — forked from althonos/setup.cfg
A `setup.cfg` template for my Python projects
View setup.cfg
name = {name}
version = {version}
author = Martin Larralde
author-email =
home-page ={name}
description = {description}
long-description = file: README.rst, CHANGELOG.rst
davidbgk /
Created Nov 8, 2018 — forked from CMCDragonkai/
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

View beautiful-html5-dialog.css
dialog {
position: fixed;
top: 50%;
left: 50%;
right: auto;
padding: 30px;
transform: perspective(500px) translate(-50%, -50%);
background: linear-gradient(to bottom, #FFF, #F4F4F4) #FFF;
border: none;
border-radius: 3px;
davidbgk /
Created Apr 4, 2017 — forked from simonw/
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using and

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
# Instructions:
# 1. Copy this script locally and run the following `chmod +x`
# 2. Later, run the following: `./` and see your MAC address changing.
echo "origin MAC address: " `sudo ifconfig en0 ether | grep ether`
sudo ifconfig en0 ether `openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
echo "new MAC address: " `sudo ifconfig en0 ether | grep ether`
View es6-feature-detection.js
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
} catch(e) {
alert('Your browser does not support ES6!')
davidbgk /
Created Jan 14, 2017 — forked from anonymous/ template
#!/usr/bin/env python
# coding=utf-8
python distribute file
from __future__ import (absolute_import, division, print_function,
unicode_literals, with_statement)
View sw-precache-config.js
swPrecache.write(path.resolve(__dirname, `../public/service-worker.js`), {
cacheId: `know-it-all`,
filename: `service-worker.js`,
stripPrefix: `public/`,
staticFileGlobs: [
`public/app.*.js`, // don't include the polyfills version
dontCacheBustUrlsMatching: [
/\.(js|json)$/, // I'm cache busting js and json files myself
View gist:bc358a9e89bfbf3bf4f79cd5f6d5bbc8
window.Promise || document.write('<script src=""><\/script>');
window.fetch || document.write('<script src=""><\/script>');
davidbgk / promise-all.js
Created Sep 8, 2016 — forked from naholyr/promise-all.js
Run promise-based async API in series or concurrency
View promise-all.js
// ( T1 => Promise<T2> ) => Array<T1> => Promise<Array<T2>>
export const concurrent = foo => vals =>
export const series = foo => vals =>
vals.reduce((p, val) => p.then(rs => foo(val).then(r => rs.concat([val]))), Promise.resolve([]))
// Usage: promiseOfValues.then(promiseAll.concurrent(functionReturningAPromiseFromAValue))
You can’t perform that action at this time.