Skip to content

Instantly share code, notes, and snippets.

View MatthewScholefield's full-sized avatar

Matthew D. Scholefield MatthewScholefield

View GitHub Profile
@MatthewScholefield
MatthewScholefield / main.cpp
Last active August 29, 2015 14:23
Font and imageTiles problem with libnds
#include <nds.h>
#include "font.h" //GRIT generated header
#include "image.h" //GRIT generated header
ConsoleFont font;
void setupFont()
{
const int tile_base = 1;
const int map_base = 0;
@MatthewScholefield
MatthewScholefield / .gitignore
Last active March 12, 2024 21:39
Include only certain file types with .gitignore
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*.*
@MatthewScholefield
MatthewScholefield / PythonArduino.py
Last active February 9, 2018 06:29 — forked from jreisstudio/PythonArduino.py
Python + Arduino on/off the LED.
import serial # you need to install the pySerial :pyserial.sourceforge.net
import time
with open('RMS_EMG.txt') as f:
lines = f.read().split('\n')
arduino = serial.Serial('/dev/tty.usbserial', 9600)
for line in lines:
brightness = int(float(line.split(',')[-1]) * 255)
arduino.write(bytes(str(brightness), 'ascii'))
@MatthewScholefield
MatthewScholefield / LICENSE
Last active September 19, 2022 15:00
Precise streaming over sockets example
Copyright 2018 Matthew Scholefield
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
@MatthewScholefield
MatthewScholefield / padatious_to_rasa.py
Created June 28, 2018 20:29
Convert padatious intent lines to rasa training data json
from typing import Dict
def create_rasa_training_data(intent_lines: Dict[str, list]) -> Dict:
return {
'rasa_nlu_data': {
'common_examples': sum([
[
{
"text": line,
@MatthewScholefield
MatthewScholefield / generate_tags.sh
Last active August 20, 2018 19:04
Generate git tags from version in setup.py over git history. Tags: PyPI, Bash, Git Tag
#!/usr/bin/env bash
n=0
while git cat-file -t HEAD~$n &>/dev/null; do
ver="$(git show "HEAD~${n}:setup.py" | grep -oP "(?<=version=\')[0-9\.]+(?=\')")"
[ -z "$ver" ] || git tag -fa "_generated-v$ver" -m "v$ver" "HEAD~$n"; n=$((n+1))
done
for i in $(git tag | grep -F '_generated-'); do
tag_name=${i/_generated-/}
@MatthewScholefield
MatthewScholefield / keybase.md
Created September 22, 2018 06:21
Keybase proof

Keybase proof

I hereby claim:

  • I am matthewscholefield on github.
  • I am mattscholefield (https://keybase.io/mattscholefield) on keybase.
  • I have a public key whose fingerprint is 97B3 5CDE 46BA 41F4 7C54 1A8F 4D57 7627 A6A3 DF75

To claim this, I am signing this object:

@MatthewScholefield
MatthewScholefield / duolingo-keyboard-control.js
Created May 12, 2019 07:45
User script to control Duolingo with Keyboard
// ==UserScript==
// @name Duolingo Keyboard Control
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add full keyboard control to Duolingo (to tiles). Shortcuts: 0-9, shift + 0-9, and "\"
// @author Matthew Scholefield
// @match https://www.duolingo.com/*
// @grant none
// ==/UserScript==
@MatthewScholefield
MatthewScholefield / LICENSE
Last active July 21, 2019 22:44
Format a Python dictionary as a tree
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@MatthewScholefield
MatthewScholefield / obfuscate.py
Created September 19, 2019 23:20
Store and run Python source encoded in a massive integer
obfuscate = lambda code: int(''.join(['{:08b}'.format(i) for i in list(bytes(code.encode()))]), 2)
run = lambda x: exec(bytes([int('{:b}'.format(x)[max(0, i - 8):i], 2) for i in range(len('{:b}'.format(x)) % 8, len('{:b}'.format(x)) + 1, 8) if i > 0]))
a = obfuscate("print('hello')")
b = a * 12
# run(b) # Will error out
run(b / 12) # Prints "hello"