Skip to content

Instantly share code, notes, and snippets.

View RemiDesgrange's full-sized avatar
❄️

Rémi Desgrange RemiDesgrange

❄️
View GitHub Profile
@RemiDesgrange
RemiDesgrange / Ksalf.py
Created March 24, 2022 21:47
A naive and basic implementation of a web server in python to better understand WSGI.
from typing import get_type_hints, Callable, Set, Union, Optional, List, Dict
from enum import Enum
from dataclasses import dataclass
class Method(Enum):
GET = "GET"
POST = "POST"
PUT = "PUT"
PATCH = "PATCH"
OPTIONS = "OPTIONS"
import aiohttp
import asyncio
async def fetch(session, url, number):
async with session.get(url) as resp:
print(f'running requests {number}')
await resp.text()
if resp.status != 200:
print(f'requests {number} failed')
return resp.status
@RemiDesgrange
RemiDesgrange / area_to_geojson.py
Last active July 7, 2019 18:12
A simple script to transform the area of massif from meteofrance into a geojson.
from typing import Dict
BASE_URL = "http://www.meteofrance.com/mf3-rpc-portlet/js/datas/zones_AVDEPT{}.json"
DEPTS = ("73", "74", "05", "38")
import requests
from geojson import Feature, FeatureCollection
def get_area(dept: str) -> Dict:
r = requests.get(BASE_URL.format(dept))
@RemiDesgrange
RemiDesgrange / .vimrc
Last active April 4, 2019 07:10
My vimrc on my machine. Highly personal. Shoutout to all the persons that helped me over the years customise it.
set nocompatible " be iMproved, required
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'rust-lang/rust.vim'
" install before : `python3 -m pip install pynvim`
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'deoplete-plugins/deoplete-jedi'
Plug 'vim-scripts/indentpython.vim'
upstream minio_servers {
server minio-1.fibrea.net;
server minio-2.fibrea.net;
server minio-3.fibrea.net;
server minio-4.fibrea.net;
}
proxy_cache_path /tmp/cache levels=1:2 keys_zone=minio_cache:10m max_size=2g inactive=60m
use_temp_path=off;
@RemiDesgrange
RemiDesgrange / proof.md
Last active June 2, 2017 14:06
Keybase proof

Keybase proof

I hereby claim:

  • I am remidesgrange on github.
  • I am rdesgrange (https://keybase.io/rdesgrange) on keybase.
  • I have a public key ASBu-PWpuhwFI5u_6wxK1H4uLjkF20Zz_rEHUhGeGbDVPAo

To claim this, I am signing this object:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0x4664d8]
goroutine 17 [running]:
_/C_/Users/me/Documents/Dev/FileSizeBeat/beat.(*DirSize).WalkFn(0xc08217a480, 0x0, 0x0, 0x0, 0x0, 0x25c0320, 0xc082177560, 0x0, 0x0)
C:/Users/me/Documents/Dev/FileSizeBeat/beat/filesizebeat.go:113 +0x38
_/C_/Users/me/Documents/Dev/FileSizeBeat/beat.(*DirSize).WalkFn-fm(0x0, 0x0, 0x0, 0x0, 0x25c0320, 0xc082177560, 0x0, 0x0)
C:/Users/me/Documents/Dev/FileSizeBeat/beat/filesizebeat.go:81 +0x7b
path/filepath.Walk(0x0, 0x0, 0xc08202bcc8, 0x0, 0x0)
c:/go/src/path/filepath/path.go:394 +0xac