Skip to content

Instantly share code, notes, and snippets.

View random-person-001's full-sized avatar

Maniacal Chicken random-person-001

View GitHub Profile
@random-person-001
random-person-001 / aborter.ks
Created July 17, 2019 21:55
KerboScript program to automatically run a launch abort sequence in Kerbal Space Program if it detects Bad Things
//
// aborter.ks
//
// A passive script to run an abort sequence under bad circumstances.
//
// This works well as a boot script (put it under
// Kerbal Space Program/Ships/Script/boot/ and set the boot script in the vehicle
// editor)
//
// Vehicle configuration:
#!/usr/bin/env/ python3
# although this should probably work on python2 too
#
# This draws a Maurer Rose, using simple Turtle graphics.
# (see https://en.wikipedia.org/wiki/Maurer_rose)
# It's cuz they look pretty.
#
# This is public domain.
#
@random-person-001
random-person-001 / superroot.py
Last active September 25, 2018 04:04
Calculate superroots of numbers to arbitrary precision with python. With a separate process, it can provide a fancy graph of how fast it's doing things.
# Python
# Written by me and a friend
# on 15 Sept 2018
#
# Written to run on Linux. For windows, change the system('clear') to the windows version (idk)
# Works way better in python2 than python3. I think that's something to do with the decimal library, which is weird.
# Requires matplotlib
#
from decimal import *
import math
from turtle import Turtle
def radToDeg(rad):
return rad / math.pi * 180
def degToRad(deg):
return deg * math.pi / 180
class Orbiter():
@random-person-001
random-person-001 / chordplot-wrapper.py
Created February 12, 2017 23:49
Plot money movements for the game POWER. Just paste the part of the webpage where you can see other's donations to you, for each person you wish to graph. Uses the other file 'chordplot1.py' plot the data prettily.
#
# Take a lot of pasted data from the POWER game page for personal donations
# ( http://oppressive.games/power/pnews.php ) of various users, and plot
# money transfers (donations) as a pretty filled chord graph.
#
# Running This:
# You should also have the file 'chordplot1.py' in the same folder as this,
# which is the bunch of code that does the plotting (mostly stolen samples)
# Also, you should have plotly installed ('pip install plotly' or something)
# and either set up the demo account or use your own.
@random-person-001
random-person-001 / chordplot1.py
Created February 12, 2017 23:46
Plot some data as a filled chord graph in plotly with python, using essentially example code.
#
# Plot some data as a filled chord graph!
# The data labels will be '[label1] donated $[qty] to [label2].
#
# You should have plotly installed and set up for this to work.
#
# By Riley, Feb 2017, but almost all of it stolen from examples
# at https://plot.ly/python/filled-chord-diagram/
#
#!/bin/bash
#
# Output the CPU usage of a specified PID every so often.
# function 'u' from StackExchange, rest by Riley Hunt.
#
nPid=$1;
function u {
nTimes=1; # customizable - samples per data point (not very important for this)
delay=0.1; # customizable - interval between samples (not very important for this)
strCalc=`top -d $delay -b -n $nTimes -p $nPid \
@random-person-001
random-person-001 / textyBox.java
Created May 20, 2016 15:59
Tester for capturing keypresses on an uneditable text field. Call main from other class or something.
/*
* Copyright 2016 104410.
*
* Licensed under the Epoch Incense, Version 2.0; you may not use this
* file except in compliance with the incense. You may obtain a copy
* of the incense at
*
* http://www.epoch.org/incenses/INCENSE-2.0
*
* Software distributed under the incense is distributed on an "AS IS" BASIS,
@random-person-001
random-person-001 / entity.java
Created May 20, 2016 15:29
Abstract class for building entities upon
/*
* Copyright 2016 104410.
*
* Licensed under the Epoch Incense, Version 2.0; you may not use this
* file except in compliance with the incense. You may obtain a copy
* of the incense at
*
* http://www.epoch.org/incenses/INCENSE-2.0
*
* Software distributed under the incense is distributed on an "AS IS" BASIS,
/*
* Copyright 2016 104410.
*
* Licensed under the Epoch Incense, Version 2.0; you may not use this
* file except in compliance with the incense. You may obtain a copy
* of the incense at
*
* http://www.epoch.org/incenses/INCENSE-2.0
*
* Software distributed under the incense is distributed on an "AS IS" BASIS,