Skip to content

Instantly share code, notes, and snippets.

View gist:b18ebd802759121abcd97b1ed07652e9
www.yorkpress.co.uk##div:matches-css(z-index: 3000100)
@alanbriolat
alanbriolat / usb-offload
Last active Aug 16, 2017
/etc/network/if-up.d/usb-offload
View 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 Aug 3, 2017
namedtuple with type casts
View crazytuple.py
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 Mar 22, 2017
Traceroute without traceroute
View traceroute.sh
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 Feb 6, 2016
disable_existing_loggers by default in Python logging's dictConfig() is horrible...
View terrible_dictConfig_defaults.py
import logging
import logging.config
# A logger that exists before configuration
log_a = logging.getLogger('a')
def f(name, x):
"""Test a logger."""
View gist:3e27890eb934f5d2b4cc
#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}
View keybase.md

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 Dec 17, 2017
A Python function for walking and mutating a tree of mappings and sequences.
View walk.py
import collections
def identity(x):
return x
def item_identity(k, v):
return k, v
View Minecraft Ore Distribution.ipynb
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 Feb 10, 2021
Fortran BIND(C) optional arguments
View bind_c_optional.c
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];