Skip to content

Instantly share code, notes, and snippets.

@alanbriolat
alanbriolat / gist:b18ebd802759121abcd97b1ed07652e9
Created October 17, 2017 09:35
My uBlock Origin custom rules
www.yorkpress.co.uk##div:matches-css(z-index: 3000100)
@alanbriolat
alanbriolat / usb-offload
Last active August 16, 2017 15:08
/etc/network/if-up.d/usb-offload
#!/bin/sh
ETHTOOL=/sbin/ethtool
[ "$IFACE" = "enx8cae4cf49551" ] || exit 0
# Disable RX checksum offloading, because it doesn't work
$ETHTOOL --offload "$IFACE" rx off
@alanbriolat
alanbriolat / crazytuple.py
Created August 3, 2017 08:56
namedtuple with type casts
from collections import namedtuple
def nocast(x):
return x
def crazytuple(name, fields, casts):
_tuple = namedtuple(name, fields)
class _casting_tuple(_tuple):
@alanbriolat
alanbriolat / traceroute.sh
Last active March 22, 2017 12:23
Traceroute without traceroute
T=8.8.8.8; MAX=30; for TTL in $(seq $MAX); do ping -c1 -t$TTL $T | grep -i "from"; [ "${PIPESTATUS[0]}" == 0 ]&&break; done
@alanbriolat
alanbriolat / terrible_dictConfig_defaults.py
Created February 6, 2016 15:12
disable_existing_loggers by default in Python logging's dictConfig() is horrible...
import logging
import logging.config
# A logger that exists before configuration
log_a = logging.getLogger('a')
def f(name, x):
"""Test a logger."""
@alanbriolat
alanbriolat / gist:3e27890eb934f5d2b4cc
Created January 21, 2016 10:26
AutoHotKey mappings
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^Insert::Send {Media_Prev}
^Home::Send {Media_Play_Pause}
^PgUp::Send {Media_Next}
XButton1::Send {MButton}

Keybase proof

I hereby claim:

  • I am alanbriolat on github.
  • I am alanbriolat (https://keybase.io/alanbriolat) on keybase.
  • I have a public key whose fingerprint is 1301 24CE B74D 9528 F3CF CD0D 83AC 368A 2100 CE08

To claim this, I am signing this object:

@alanbriolat
alanbriolat / walk.py
Last active December 17, 2017 17:04
A Python function for walking and mutating a tree of mappings and sequences.
import collections
def identity(x):
return x
def item_identity(k, v):
return k, v
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alanbriolat
alanbriolat / bind_c_optional.c
Last active February 10, 2021 16:55
Fortran BIND(C) optional arguments
void do_the_thing(int*, double*, double*, double*);
extern const int blah;
int main(int argc, char **argv)
{
int n = 5;
double x[5] = {1, 2, 3, 4, 5};
double y[5] = {10, 20, 30, 40, 50};
double z[5];