Skip to content

Instantly share code, notes, and snippets.

View BonsaiDen's full-sized avatar

Ivo Worms BonsaiDen

View GitHub Profile
FUNCTION descent_math {
PARAMETER radar_offset.
PARAMETER target_height.
LOCAL descent_rate TO -SHIP:VERTICALSPEED.
LOCAL clearance TO MAX(ALT:RADAR - radar_offset - target_height, 0).
// Work out centripetal acceleration (i.e. an upward acceleration component
// due to the planet curving away from us)
DECLARE PARAMETER waypointName.
DECLARE PARAMETER withinRadius.
SET w TO WAYPOINT(waypointName).
print("--- ROVER DRIVE TO PROGRAM ---").
print("[INFO] Waypoint: " + waypointName).
print("[INFO] Distance: " + w:GEOPOSITION:DISTANCE + "m").
print("[INFO] ETA: " + w:GEOPOSITION:DISTANCE / 4.0 + "s").
@BonsaiDen
BonsaiDen / user.js
Last active February 28, 2017 07:42
Stuff
// ==UserScript==
// @name AntiNintendoSpoiler
// @namespace foobar
// @include https://www.youtube.com/*
// @version 1
// @grant none
// ==/UserScript==
var originalOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
@BonsaiDen
BonsaiDen / code.rs
Created April 14, 2016 14:59
rustfmt results
// Before ---------------------------------------------------------------------
self.delay_until_good_mode = cmp::min(
self.delay_until_good_mode,
MAX_GOOD_MODE_TIME_DELAY
);
// After ----------------------------------------------------------------------
self.delay_until_good_mode = cmp::min(self.delay_until_good_mode,
MAX_GOOD_MODE_TIME_DELAY);

Mate Desktop:

sudo apt-add-repository ppa:ubuntu-mate-dev/ppa
sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install --no-install-recommends ubuntu-mate-core ubuntu-mate-desktop

Light DM Greeter

sudo dpkg-reconfigure lightdm

@BonsaiDen
BonsaiDen / racer.vim
Last active September 9, 2015 16:11
Patched racer.vim
" Vim plugin for Racer
" (by Phil Dawes)
"
" 1. Edit the variables below (or override in .vimrc)
" 2. copy this file into .vim/plugin/
" 3. - now in insert mode do 'C-x C-o' to autocomplete the thing at the cursor
" - in normal mode do 'gd' to go to definition
"
" (This plugin is best used with the 'hidden' option enabled so that switching buffers doesn't force you to save)
@BonsaiDen
BonsaiDen / record.sh
Last active September 3, 2023 10:12
Record from Virtual Frame Buffer via ffmpeg
xvfb-run -s "-screen 0 1280x800x16" -e /dev/stdout -a /home/ivo/Desktop/foo.sh
./ffmpeg -r 30 -f x11grab -draw_mouse 0 -s 1280x800 -i :99 -c:v libvpx -quality realtime -cpu-used 0 -b:v 384k -qmin 10 -qmax 42 -maxrate 384k -bufsize 1000k -an screen.webm
# foo.sh
google-chrome --incognito --window-size=1280,800 --app=http://github.com
@BonsaiDen
BonsaiDen / substrat2.js
Created March 6, 2015 16:58
Ideas for Substrat 2
// Disable compress and concat filters, this turns them into forwarders
sub.disable('compress').disabled('concat');
// filter takes but keeps, reduced takes and removes
var libs = sub.reduce(/lib\/.*\.js$/).compress().concat(),
config = sub.reduce('js/global.js').compile(sub.mustache()),
app = config.merge(sub.reduce([
{
"predef": [ "-Promise" ],
// JShint
"passfail" : false, // if the scan should stop on first error
// Tolerate features
"eqnull" : false, // if == null comparisons should be tolerated
"sub" : true, // if all forms of subscript notation are tolerated
"asi" : false, // if automatic semicolon insertion should be tolerated
@BonsaiDen
BonsaiDen / starfield.glsl
Last active January 6, 2024 11:35
WebGL Starfield Shader for THREE.js
uniform vec2 resolution;
uniform float time;
vec3 mod289(vec3 x) {
return x - floor(x * (1.0 / 239.0)) * 239.0;
}
vec2 mod289(vec2 x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
}