This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://gist.github.com/pavel-kirienko/32e395683e8b7f49e71413aebf5e1a89 | |
# Pavel Kirienko <pavel@opencyphal.org> | |
HELP="Register slcan-enabled serial-to-CAN adapters as network interfaces. | |
Usage: | |
`basename $0` [options] <tty0> [[options] <tty1> ...] | |
Interface indexes will be assigned automatically in ascending order, i.e., the | |
first device will be mapped to slcan0, second to slcan1, and so on. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By default, X-Box 360-compatible controllers are detectable but dysfunctional because they expect the host | |
# to send a particular USB control transfer with some sort of initialization command. | |
# This udev rule will invoke a trivial Python script automatically when the gamepad is connected that emits | |
# the required initialization command. | |
# | |
# Integration: | |
# 1. Put this rule into /etc/udev/rules.d/51-xbox-gamepad.rules | |
# 2. Install pyusb for the root's Python: sudo pip install pyusb | |
# 3. Reload udev rules as root: udevadm control --reload-rules && udevadm trigger | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <tuple> | |
#include <type_traits> | |
#include <cassert> | |
template <class T, class... TArgs> decltype(void(T{std::declval<TArgs>()...}), std::true_type{}) test_is_braces_constructible(int); | |
template <class, class...> std::false_type test_is_braces_constructible(...); | |
template <class T, class... TArgs> using is_braces_constructible = decltype(test_is_braces_constructible<T, TArgs...>(0)); | |
struct any_type { | |
template<class T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Convert a raw binary image into an ELF file suitable for loading into a disassembler | |
cat > raw$$.ld <<EOF | |
SECTIONS | |
{ | |
EOF | |
echo " . = $3;" >> raw$$.ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
*/ | |
#include <arpa/inet.h> | |
#include <linux/if_packet.h> | |
#include <linux/ip.h> |