Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Moon triffid

View GitHub Profile
@triffid
triffid / rpc.py
Last active Sep 1, 2022
rock paper scissors lizard spock python POC
View rpc.py
#!/usr/bin/env python3
import random
choices = ["scissors","paper","rock","lizard","spock"]
interactions = [
[ "", "cut", "", "behead", ""],
[ "", "", "wraps", "", "disproves"],
[ "smashes", "", "", "crushes", ""],
[ "", "eats", "", "", "poisons"],
@triffid
triffid / cat.py
Created Jul 28, 2022
cat box puzzle
View cat.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from random import randint
from functools import reduce
print("There is a row of boxes. A cat is hiding in one of the boxes.")
print("Every time you check a box, the cat (invisibly) moves to an adjacent box.")
print()
print("Find a pattern that corners the cat with the least number of checks!")
@triffid
triffid / 10-keyboard.conf
Created Apr 8, 2022
Xorg keyboard with altgr-intl default and hold capslock = greek layout
View 10-keyboard.conf
Section "InputClass"
Identifier "keyboard-all"
Driver "evdev"
MatchIsKeyboard "on"
Option "XkbLayout" "us,gr"
Option "XkbVariant" "altgr-intl,"
Option "XkbOptions" "grp:caps_switch,terminate:ctrl_alt_bksp,keypad:future,nbsp:level3n,lv3:ralt_switch_multikey"
EndSection
View orbelems.cpp
/*
* This is some code that converts cartesian coordinate state vectors to
* classical orbital elements, and back again.
*/
#include <stdio.h>
#include <math.h>
double Em11 = 0.00000000001;
double G = 6.67300 * Em11;
@triffid
triffid / Makefile
Last active Jun 1, 2020
Yet another arduino Makefile
View Makefile
MCU_TARGET=atmega328p
ARDUINO_DIR=/usr/share/arduino
ARDUINO_HARDWARE:=$(ARDUINO_DIR)/hardware/arduino
ARDUINO_CORE:=$(ARDUINO_HARDWARE)/avr/cores/arduino
ARDUINO_VARIANT:=$(ARDUINO_HARDWARE)/avr/variants/standard
ARDUINO_CORE_LIBRARIES=Wire SPI
ARDUINO_LIBDIRS=Adafruit_MLX90614_Library
@triffid
triffid / openrc-init-pia
Last active Jul 16, 2022
shell script for accessing PIA wireguard
View openrc-init-pia
#!/sbin/openrc-run
command="/root/bin/pia-wg.sh"
CONFIGDIR="${CONFIGDIR:-/var/cache/pia-wg}"
CONFIG="${CONFIG:-/etc/pia-wg/pia-wg.conf}"
extra_started_commands="reload"
depend() {
@triffid
triffid / fix-printf.c
Created May 4, 2020
make printf work (arduino)
View fix-printf.c
// from https://forum.arduino.cc/index.php?topic=149785.msg1125620#msg1125620
#include "fix-printf.h"
#include <stdlib.h>
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
View input.settings
[BASE_ALL_ATTACKS]
IK_None=(Action=SpecialAttackLight,State=Duration,IdleTime=0.2)
IK_None=(Action=SpecialAttackWithAlternateHeavy,State=Duration,IdleTime=0.2)
IK_None=(Action=SpecialAttackHeavy,State=Duration,IdleTime=0.2)
IK_None=(Action=AttackWithAlternateHeavy)
IK_LShift=(Action=PCAlternate)
IK_Pad_Y_TRIANGLE=(Action=SpecialAttackHeavy,State=Duration,IdleTime=0.2)
IK_Pad_Y_TRIANGLE=(Action=AttackHeavy)
IK_LeftMouse=(Action=AttackWithAlternateLight)
IK_LeftMouse=(Action=SpecialAttackWithAlternateLight,State=Duration,IdleTime=0.2)
@triffid
triffid / involute_gear_2d.scad
Created Feb 11, 2015
openscad 2d involute gear
View involute_gear_2d.scad
module gear_shape_2d (
number_of_teeth = 15,
circular_pitch = false, diametral_pitch = false,
pressure_angle = 28,
clearance = 0.2,
circles=0,
backlash=0,
involute_facets=0)
{
if (circular_pitch==false && diametral_pitch==false)
@triffid
triffid / persistent.sfs
Created Feb 16, 2014
KSP persistence - EL debugging
View persistent.sfs
This file has been truncated, but you can view the full file.
GAME
{
version = 0.23.0
Title = Lentil (CAREER)
Description = No description available.
Mode = 1
Status = 1
scene = 5
flag = Squad/Flags/kerbinmunflag