Skip to content

Instantly share code, notes, and snippets.

@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}
@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 / 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 / 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 / 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 / gist:b18ebd802759121abcd97b1ed07652e9
Created October 17, 2017 09:35
My uBlock Origin custom rules
www.yorkpress.co.uk##div:matches-css(z-index: 3000100)