Skip to content

Instantly share code, notes, and snippets.

View PyroSA's full-sized avatar

Werner Ackermann PyroSA

View GitHub Profile
@PyroSA
PyroSA / asparagus_stage.to2
Created April 26, 2023 03:39
Balanced Tanks with Dry Staging - KontrolSystem2
use { Vessel } from ksp::vessel
use { CONSOLE } from ksp::console
use { current_time, sleep, wait_until } from ksp::game
use { create_resource_transfer, FlowDirection } from ksp::resource
use { format } from core::str
use { max, min, clamp } from core::math
// Balance Methane, Oxidizer and Hydrogen; trigger dry stages
fn balance_up_tanks(vessel: Vessel) -> Result<Unit, string> = {
CONSOLE.clear()
@PyroSA
PyroSA / telemetry-launch.to2
Created April 11, 2023 04:42
A extended launch script for KOS2 for KSP2
use { Vessel, AutopilotMode } from ksp::vessel
use { trigger_staging } from std::staging
use { current_time, sleep, wait_until } from ksp::game
use { acos_deg, max, min, clamp } from core::math
use { CONSOLE } from ksp::console
use { estimate_burn_time, exec_next_node } from std::vac
use { circularize_orbit_at, circularize_orbit } from std::maneuvers
use { add_time_series, remove_all_time_series } from ksp::telemetry
use { angle_axis} from ksp::math
use { format } from core::str
@PyroSA
PyroSA / fan.c
Last active June 21, 2024 22:45
OrangePi5 PWM Fan Control
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <wiringPi.h>
#include <softPwm.h>
#define PIN 10
#define RANGE 100
@PyroSA
PyroSA / rxjs.sync.js
Last active February 21, 2017 21:28
RxJs Observable to run a series of promises in series with no concurrency
const Rx = require('rxjs'); // Did this in node using `npm install rxjs`
// -- Our fake async function
const fakeAsync = (input) => {
return new Promise((resolve, reject) => {
console.log(`Start: ${input}`);
setTimeout(() => {
console.log(`Finish: ${input}`);
resolve(`Processed ${input}`);
}, Math.random()*1500+100);
@PyroSA
PyroSA / MikroTike-NoIp-DDNS-update.txt
Created January 24, 2016 11:52
MikroTik NoIp DDNS update script
# No-IP automatic Dynamic DNS update
#--------------- Change Values in this section to match your setup ------------------
# No-IP User account info
:local noipuser "username@gmail.com"
:local noippass "password1"
# Set the hostname or label of network to be updated.
# Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.