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 python3 | |
"""Download random xkcd comic""" | |
import json | |
import random | |
import subprocess | |
import textwrap | |
from pathlib import Path | |
from urllib.request import urlopen, urlretrieve |
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
{ | |
"basics": { | |
"name": "Jacques Rimbault", | |
"label": "Développeur 5 ans d'expérience", | |
"email": "[email protected]", | |
"phone": "+336309644882", | |
"location": { | |
"city": "Paris" | |
}, | |
"profiles": [ |
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
/* In a config object : | |
{ | |
"endpoints": { | |
"createUser": { | |
"path": "/users", | |
"method": "POST" | |
} | |
"listUsers": { | |
"path": "/users", | |
"method": "GET" |
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
public static class TypeExt | |
{ | |
public static string HumanReadableName(this Type self) | |
{ | |
return InnerHumanReadable(self).ToString(); | |
} | |
private static System.Text.StringBuilder InnerHumanReadable(Type self) | |
{ | |
if (!self.IsGenericType) |
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
using System; | |
using System.Threading; | |
namespace Sync | |
{ | |
// If C# had different (slightly better imo) visibility semantics | |
// that interface wouldn't exists and the nested type wouldn't need to be nested. | |
// The "best" we can do is use the repo version, put it in its own project and use | |
// the `internal` visibility, which is dumb shit. | |
public interface IMutexGuard<T> : IDisposable |
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 python3 | |
"""Algorithm | |
1. read rows sorted by date : | |
- avg O(n log n) | |
- best O(n) | |
- worst O(n log n) | |
2. partition by name : O(n) | |
put all rows in buckets keyed by user id/name, |
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 python3 | |
import argparse | |
import csv | |
import os | |
import sys | |
from pathlib import Path | |
def main(args): |
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
interface ResultMethods<T, E> { | |
ok(): T | null, | |
err(): E | null, | |
unwrap(): T | never, | |
unwrapErr(): E | never, | |
expect(message: string): T | never, | |
expectErr(message: string): E | never, | |
map<U>(f: (value: T) => U): Result<U, E>, | |
mapErr<U>(f: (error: E) => U): Result<T, U>, | |
andThen<U>(f: (value: T) => Result<U, E>): Result<U, E>, |
NewerOlder