Skip to content

Instantly share code, notes, and snippets.

View triffid's full-sized avatar

Michael Moon triffid

View GitHub Profile
@triffid
triffid / current-kernel-1.ebuild
Created April 7, 2023 11:49
Gentoo ebuild that depends on running dist-kernel
# Copyright 2021-2023 Gentoo Authors, 2023- Triffid_Hunter
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION="Ebuild to depend on currently running Kernel"
HOMEPAGE=""
SRC_URI=""
LICENSE=""
@triffid
triffid / rpc.py
Last active September 1, 2022 19:05
rock paper scissors lizard spock python POC
#!/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 July 28, 2022 11:47
cat box puzzle
#!/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 April 8, 2022 14:42
Xorg keyboard with altgr-intl default and hold capslock = greek layout
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
/*
* 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 June 1, 2020 20:26
Yet another arduino 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 February 15, 2024 06:48
shell script for accessing PIA wireguard
#!/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 12:32
make printf work (arduino)
// 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"
[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 February 11, 2015 02:31
openscad 2d involute gear
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)