Skip to content

Instantly share code, notes, and snippets.

View compupro's full-sized avatar
🍞
Loafing around

compupro

🍞
Loafing around
View GitHub Profile
@compupro
compupro / computercraft_turtle_pokehole.lua
Last active June 29, 2019 01:55
Pokehole mining program for ComputerCraft mining turtles
-- compupro's pokehole program for ComputerCraft mining turtle
-- usage: save as "pokehole", and you can run "pokehole <number>"
-- it will generate a pokehole mine with some length determined
-- by <number>. I haven't tried this program in like two years,
-- so I have no idea if it works, but it probably does.
-- It looks for fuel in slot 1
function doRefuelling ()
turtle.select(1)
if turtle.getFuelLevel() < 20000 then
turtle.refuel()
@compupro
compupro / osu_performance_comparator.py
Created March 8, 2019 05:46
Compares ranked statistics between two Osu users for a specified mapset. Must supply Osu! api_key, map IDs for the mapset, and user IDs
import urllib
import urllib.request
import json
api_key = ''
mapset = {
"Bye Bye Yesterday - Taeyang's Good Good Time": "1026729",
"Crush (Radio Edit) - Collab Extra": "1531707"
}
@compupro
compupro / kakegurui_guillotine_simulator.py
Created January 21, 2019 23:32
Simulates the guillotine game in Kakegurui with random and nonrandom player strategies
import random
class Guillotine:
def __init__(self):
self.triggered = False
self.guillotine = [False for _ in range(19)]
self.guillotine.append(True)
random.shuffle(self.guillotine)
def cut(self, n):
@compupro
compupro / newarch.js
Last active April 30, 2019 16:38
JS Parliament Diagram Generator - A client-side JavaScript port of the newarch.py Arch-style parliament diagram tool in https://github.com/slashme/parliamentdiagram
//A client-side JavaScript port of the newarch.py Arch-style parliament diagram tool in https://github.com/slashme/parliamentdiagram
//License GPLv2.0
//Total number of seats per number of rows in SVG
const TOTALS = [3, 15, 33, 61, 95, 138, 189, 247, 313, 388, 469, 559, 657, 762, 876, 997, 1126, 1263, 1408, 1560, 1722, 1889, 2066, 2250, 2442, 2641, 2850, 3064, 3289, 3519, 3759, 4005, 4261, 4522, 4794, 5071, 5358, 5652, 5953, 6263, 6581, 6906, 7239, 7581, 7929, 8287, 8650, 9024, 9404, 9793, 10187, 10594, 11003, 11425, 11850, 12288, 12729, 13183, 13638, 14109, 14580, 15066, 15553, 16055, 16557, 17075, 17592, 18126, 18660, 19208, 19758, 20323, 20888, 21468, 22050, 22645, 23243, 23853, 24467, 25094, 25723, 26364, 27011, 27667, 28329, 29001, 29679, 30367, 31061];
/*Data object for a party to be drawn as an SVG group*/
class SVGParty {
constructor(id, delegates, fill, stroke){
this.id = id;
@compupro
compupro / WritingBox.js
Last active April 30, 2019 16:38
WritingBox.js - Lets you turn a canvas into a canvas you can write on with your mouse
class WritingBox {
/*Define a canvas as a WritingBox by instantiating a WritingBox with the id of the canvas
elemId: The id of the <canvas> element*/
constructor(elemId){
this.writingArea = document.getElementById(elemId);
this.gfxCtx = writingArea.getContext("2d");
this.clickX = [];