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
davidbgk / http_streaming.md
Created Nov 8, 2018 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)
View http_streaming.md

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

@davidbgk
davidbgk / nginx.conf
Created May 3, 2018
nginx conf to proxy carto tiles
View nginx.conf
proxy_cache_path /srv/user/cache levels=1:2 keys_zone=tiles-cache:8m max_size=500000m inactive=1000d;
proxy_temp_path /srv/user/cache/tmp;
upstream openaip_backend {
server 1.tile.maps.openaip.net;
server 2.tile.maps.openaip.net;
server 3.tile.maps.openaip.net;
}
upstream cartodb_backend {
@davidbgk
davidbgk / stimulus.html
Last active Mar 27, 2018
Playing with Stimulus tutorial
View stimulus.html
<!doctype html>
<meta charset=utf-8>
<title>Hello Stimulus</title>
<script src="https://unpkg.com/stimulus/dist/stimulus.umd.js"></script>
<script>
window.addEventListener('DOMContentLoaded', _ => {
const application = Stimulus.Application.start()
application.register('hello', class extends Stimulus.Controller {
static get targets () {
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
davidbgk / stats.md
Created Jun 22, 2017
Statistiques autour des données datagouv compilées pendant la Workweek
View stats.md

Stats Datagouv

Au 2017-06-20, il y a 65535 resources et 24699 datasets.

Il y a 52618 ressources de type file, 17642 de type remote et 409 de type api.

Il y a 37847 ressources inspire + geo-ide récupérées via la passerelle Inspire sur les 65535 resources disponibles (soit 58%) qui sont indiquées comme étant de type file alors qu’elles sont remote.

Il y a donc 14771 ressources locales de type file auxquelles il faut enlever les anciennes ressources (v1 de datagouv) qui dupliquaient les données distantes ainsi que les données publiées via l’API sans préciser le type (file est le type attribué par défaut (?)).

@davidbgk
davidbgk / index.html
Last active Sep 26, 2017
Dealing with (non)critical CSS, the progressive enhancement way
View index.html
<!doctype html><!-- This is a valid HTML5 document. -->
<meta charset=utf-8><!-- Better(?) to include encoding before the <title>. -->
<title>Test template</title><!-- Required to make a valid HTML5 document. -->
<link rel=icon href="data:;base64,iVBORw0KGgo="><!-- Blank gif, avoids an extra query. -->
<style>
/* Critical CSS only: above the fold, positionning and so on. */
p { background-color: red; }
</style>
<!-- Preload the not critical CSS for future usage. -->
<link rel=preload href=not-critical.css as=style onload="this.rel='stylesheet'">
@davidbgk
davidbgk / index.html
Last active May 8, 2017
Test with SkateJS and Firefox 53
View index.html
<!doctype html>
<meta charset=utf-8>
<title>Test skatejs</title>
<link rel=icon href="data:;base64,iVBORw0KGgo=">
<script src=https://unpkg.com/skatejs-web-components@0.0.1/dist/index.min.js></script>
<script src=https://unpkg.com/skatejs@4.6.7/dist/index-with-deps.min.js></script>
<script>
const { skate } = window
class Hello extends skate.Component {
static get is () {
@davidbgk
davidbgk / server.py
Created Apr 11, 2017
An attempt to create the simplest HTTP Hello world in Python3
View server.py
import http.server
import socketserver
from http import HTTPStatus
class Handler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(HTTPStatus.OK)
self.end_headers()
self.wfile.write(b'Hello world')
@davidbgk
davidbgk / recover_source_code.md
Created Apr 4, 2017 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory
View recover_source_code.md

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 https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
View mac-address-spoofer.sh
#/bin/sh
# Instructions:
# 1. Copy this script locally and run the following `chmod +x mac-address-spoofer.sh`
# 2. Later, run the following: `./mac-address.spoofer.sh` 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`
You can’t perform that action at this time.