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
//compile:gcc -Wall -Wextra -Werror -pedantic -O3 $(pkg-config --cflags --libs | |
// libusb-1.0) -o $A0 $SRC | |
//dev:gcc -Wall -Wextra -Werror -pedantic -fsanitize=address | |
// -fsanitize=undefined -g $(pkg-config --cflags --libs libusb-1.0) -o $A0 $SRC | |
#include <libusb.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
// this may need to be changed depending on your controller |
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
""" | |
wiki_reader.py - Crude script to read a wikipedia article from an offset and an article ID | |
To find an article ID, use bzgrep on | |
enwiki-latest-pages-articles-multistream-index.txt.bz2 | |
For example (in my shell *index* expands to enwiki-latest-pages-articles-multistream-index.txt.bz2): | |
bzgrep "Python (programming language)" *index* | |
Requires the bzip2 compressed dumps of Wikipedia. Download | |
enwiki-latest-pages-articles-multistream-index.txt.bz2 and |
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
{"ZPDQ":{"airportCodeIata":"DIG","airportName":"Deqen Shangri-La Arpt","cityName":"Deqen","cityType":"International","countryCode":"CN","region":"","meta":{"icaoCode":"ZPDQ","iataCode":"DIG","latitudeDegreeNum":27.7936000824,"longitudeDegreeNum":99.6772003174,"timeZoneDesc":"Asia/Shanghai"}},"KSGF":{"airportCodeIata":"SGF","airportName":"Springfield-Branson Rg","cityName":"Springfield","cityType":"Domestic","countryCode":"US","region":"MO","meta":{"icaoCode":"KSGF","iataCode":"SGF","latitudeDegreeNum":37.24570084,"longitudeDegreeNum":-93.38860321,"timeZoneDesc":"America/Chicago"}},"KFOE":{"airportCodeIata": "FOE","airportName":"Forbes Field","cityName":"Forbes Field","cityType":"Domestic","countryCode":"US","region":"United States","meta":{"icaoCode":"KFOE","iataCode":"FOE","latitudeDegreeNum":37.24570084,"longitudeDegreeNum":-93.38860321,"timeZoneDesc":"America/Chicago"}},"KBED":{"airportCodeIata":"BED","airportName":"Laurence G. Hanscom Field","cityName":"Laurence G. Hanscom Field","cityType":"Domestic","co |
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
// ==UserScript== | |
// @name Use HTML Gmail as Default | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2 | |
// @description Set the HTML version of Gmail as the default, and add an account switcher | |
// @author Michael M | |
// @match https://mail.google.com/mail/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// @run-at document-start |
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
from struct import pack | |
# WAV format reference: http://soundfile.sapp.org/doc/WaveFormat/ | |
# one period of a sine wave in 8 samples | |
beep = bytes([0x80, 0xd9, 0xff, 0xd9, 0x80, 0x26, 0x01, 0x26]) * 80 | |
# one period of silence | |
sil = bytes([80] * 8) * 80 | |
# morse code |
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
// ==UserScript== | |
// @name Explain XKCD shortcut | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Shows link to Explain XKCD on xkcd.com | |
// @author michaelfm1211 | |
// @match https://xkcd.com/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// ==/UserScript== |
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
from PIL import Image | |
from math import ceil | |
# these variables are not used everywhere and some parts just assume that they are both (100, 100). | |
# change at your own risk. | |
scale = (100, 100) | |
res = (100, 100) | |
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 has been tested on macOS and Alpine Linux, but not Windows. Both | |
// GCC Clang and GNU GCC have also been tested to work. Ideally, this program | |
// should work on any x86-64 machine. | |
// | |
// the program assumes it's binary is called "poly", so you must change the | |
// source code if you want to rename the executable to anything else. | |
#include <arpa/inet.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
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
# adapted from https://www.orangecoat.com/how-to/read-and-decode-data-from-your-mouse-using-this-pyusb-hack | |
# requirements: | |
# - macOS (although it may be adapted for linux) | |
# - pyusb (https://pypi.org/project/pyusb/) | |
# - my totp program (https://github.com/michaelfm1211/totp). you might be able to use another totp program | |
# - the accompanying totp-copy.sh (https://gist.github.com/michaelfm1211/32336940e1d27c4b2a44c9e3f665f26c). again, may be adapted for linux | |
# - terminal-notifier (https://github.com/julienXX/terminal-notifier). not stricly needed, but nice to have | |
import atexit |
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 <signal.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/ioctl.h> | |
#include <unistd.h> | |
bool rflag = false; | |
float speed = 0.05; |
NewerOlder