Skip to content

Instantly share code, notes, and snippets.

Avatar

Rémy Sanchez Xowap

View GitHub Profile
@Xowap
Xowap / keybase.md
Last active Nov 17, 2019
Keybase verification
View keybase.md

Keybase proof

I hereby claim:

  • I am xowap on github.
  • I am xowap (https://keybase.io/xowap) on keybase.
  • I have a public key ASC37lc_Cup93wSKmGt4SSwNZ-tAAQ6bTbyNbOXbUpZRUwo

To claim this, I am signing this object:

View pydantic_verbosity.py
from pydantic import BaseModel, ValidationError
from typing import Union
class A(BaseModel):
a: Union["A", "B"]
class B(BaseModel):
a: Union["A", "B"]
View jupiter_lci.py
from argparse import ArgumentParser, Namespace
from base64 import b64encode
from json import dumps
from pprint import pprint
from typing import Optional, Sequence, Text
from urllib.parse import ParseResult, urljoin, urlparse
from requests_html import HTMLSession
@Xowap
Xowap / house_avocode.svg
Last active Dec 7, 2018
Avocode SVG optimization
View house_avocode.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Xowap
Xowap / requests_html_hotfix.py
Last active Jul 9, 2018
Fix pyppeteer download location
View requests_html_hotfix.py
"""
This is a monkey patch of the requests-html module so it can download chrome
and store its data in a custom location and not in the home directory (which
is not writable on servers and also we do not want chrome stored there).
"""
from os.path import (
join,
)
from pathlib import (
@Xowap
Xowap / serialized_replace.py
Last active Jun 6, 2018
Search & Replace in PHP serialized values
View serialized_replace.py
#!/usr/bin/env python3
from argparse import ArgumentParser
from sys import stdin, stdout
import re
SER_STR = re.compile(r"s:(\d+):(\\*\")(.*?)(\\*\");")
def parse_args():
View gdpr.yml
---
# List here all data controllers
controllers:
- name: Control Corporation
address: 42 control road, 75000 Paris, France
organisational_part: Control Part
contact_person: Jean-Claude Control
# That's all recipients for this data, wether internal database or an
@Xowap
Xowap / default.py
Last active Dec 6, 2017
An attempt to validate data as you read it (something in the mood of PEP 463)
View default.py
from typing import TypeVar, Callable, Any, Optional, Tuple, Type
DATA_ERROR = (
KeyError,
TypeError,
ValueError,
AttributeError,
IndexError,
AssertionError,
)
View restart_services.sh
#!/bin/bash
SERVBIN=${SERVBIN:-/usr/sbin/service}
success=0
function echo_rep {
echo -n $(tput cuu1)
echo -n $(tput ed)
echo "$1"
}
@Xowap
Xowap / anonymize_email.py
Created Jul 3, 2017
A script to anonymize emails in a SQL dump
View anonymize_email.py
#!/usr/bin/env python3
# coding: utf-8
import argparse
import re
from uuid import uuid4
from hashlib import sha256
SALT = str(uuid4()).encode()
You can’t perform that action at this time.