Skip to content

Instantly share code, notes, and snippets.

View olivierphi's full-sized avatar

Olivier Philippon olivierphi

View GitHub Profile
@olivierphi
olivierphi / confirm.py
Last active September 15, 2023 08:48
quick confirm script to pipe in a terminal
#!/bin/env python
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"-l",
"--level",
choices=("e", "m", "h"),
default="m",
@olivierphi
olivierphi / snippet.py
Created September 4, 2023 14:17
log SQL queries in a Django shell
import logging; db_logger = logging.getLogger("django.db.backends"); db_logger.addHandler(logging.StreamHandler()); db_logger.setLevel(logging.DEBUG)
# ~/.config/kitty/kitty.conf
# theme setting: kitty +kitten themes --reload-in=all Catppuccin-Mocha
# https://github.com/catppuccin/kitty
font_family Roboto Mono
font_size 12.0
editor code
# enabled_layouts fat:bias=50;full_size=1
@olivierphi
olivierphi / test_black.py
Created December 2, 2019 13:24
a Black bug illustration (19.10b0)
import asyncio
import aiohttp
from _pytest.monkeypatch import MonkeyPatch
from app import test_utils
async def test_ping_1(
aiohttp_client: aiohttp.test_utils.TestClient,
@olivierphi
olivierphi / test-geocoder.melody.php
Created April 24, 2015 11:30
PHP Geocoder test
<?php
<<<CONFIG
packages:
- "willdurand/geocoder: ~3.0"
- "symfony/var-dumper: ~2.6"
CONFIG;
/**
* [PHP GeoCoder](https://github.com/geocoder-php/Geocoder) rulez! ♥
*/
@olivierphi
olivierphi / print.js
Created December 5, 2014 16:23
Repeat an element for each page on Reveal.js printed PDF
if (window.location.search.match( /print-pdf/gi )) {
(function () {
// Conditionally Load jQuery (javascript)
// Source: https://gist.github.com/gists/902090/
var init, maybeLoadJq;
init = function() {