Skip to content

Instantly share code, notes, and snippets.

View fincham's full-sized avatar

Michael Fincham fincham

View GitHub Profile
#!/usr/bin/env python2
# blackwidow_enable.py
#
# Enables the M1-5 and FN keys to send scancodes on the Razer BlackWidow
# and BlackWidow Ultimate keyboards.
#
# You can use 'xev' and 'xbindkeys' to assign actions to the macro keys.
#
# Requires the PyUSB library.
@fincham
fincham / bluetooth
Created September 23, 2015 08:13
/etc/initramfs-tools/hooks/bluetooth
#!/bin/sh -e
if [ "$1" = "prereqs" ]; then exit 0; fi
. /usr/share/initramfs-tools/hook-functions
mkdir -p $DESTDIR/lib/firmware
cp -pr /lib/firmware/* $DESTDIR/lib/firmware
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def option_negotiator(socket, command, option):
# telnet really sucks, if you wanted more proof:
if command in (DO, DONT):
if command == DO and option == TTYPE: # "can you tell me your terminal type?"
socket.sendall(IAC + WILL + TTYPE) # "of course I will! let's do a whole pointless subnegotiation!"
else: # for all other commands just refuse
socket.sendall(IAC + WONT + option)
elif command in (WILL, WONT):
if command == WILL and option == ECHO: # "I will echo all characters back to you"
socket.sendall(IAC + DO + ECHO) # "yes please, echo all characters"
@fincham
fincham / gist:b5d65a56618e878e6fc6b44460cd5c11
Created October 17, 2016 02:45
Is this machine a Soekris?
# stolen from OpenBSD's kernel
dd if=/dev/mem bs=64k skip=15 count=1 | grep -q -a 'Soekris Engineering'
Facter.add('is_soekris') do
setcode do
Facter::Core::Execution.execute("dd if=/dev/mem bs=64k skip=15 count=1 | grep -q -a 'Soekris Engineering' && echo true || echo false") == "true"
end
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.