Skip to content

Instantly share code, notes, and snippets.

View thexa4's full-sized avatar

Max Maton thexa4

  • Delft, Netherlands
View GitHub Profile
@thexa4
thexa4 / kittens.js
Last active April 9, 2024 16:28
Idle managers
// https://kittensgame.com/web/
var astronomyButton = document.getElementById("observeButton");
function buildBuilding(name) {
let buttons = gamePage.bldTab.children;
for (var b of buttons) {
if (b.model.name.startsWith(name)) {
if(b.model.enabled && b.controller.hasResources(b.model)) {
b.model.prices = b.controller.getPrices(b.model);
#!/usr/bin/env python3
import pyvo
import requests
import sqlite3
from datetime import datetime
service_name = "Gaia@AIP"
url = "https://gaia.aip.de/tap"
token = ''
@thexa4
thexa4 / ATV Firmware.cs
Last active January 24, 2023 03:23
Space Engineers scripts
bool _autoPowerSave = true;
IMyTextSurface _cockpitSurface;
RectangleF _viewport;
List<IMyCargoContainer> _containers = new List<IMyCargoContainer>();
List<IMyEntity> _storages = new List<IMyEntity>();
IMyGasGenerator _splitter;
List<IMyBatteryBlock> _batteries = new List<IMyBatteryBlock>();
function printf {
declare parameter format.
local sentinel to lex().
local args to list().
declare parameter last to sentinel.
local test to last.
until test = sentinel {
args:add(test).
declare parameter last to sentinel.
@thexa4
thexa4 / day1a
Last active December 11, 2018 00:20
Advent calendar 2018
#!/bin/bash
(printf "puts "; cat) | tr -d "\n" | ruby
import copy
class ParallelPlayer
def __init__(self, prototype, concurrent_games):
self.prototype = prototype
self.instances = [None] * concurrent_games
self.seen_hand = [False] * concurrent_games
def start_game(self, game_id):
self.instances[game_id] = copy.deepcopy(self.prototype)
@thexa4
thexa4 / ceph-slow-rebalance
Created October 23, 2017 08:01
Rebalance ceph
while true; do
sleep 5m;
if ceph -s | grep -q 'are blocked'; then
echo 'skip, blocked'
continue
fi
if ceph -s | grep -q 'osd down'; then
#!/bin/sh
# postinst script for empires-gitlab-runner
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
@thexa4
thexa4 / migrate-repo-to-lfs.sh
Last active December 18, 2016 22:30 — forked from karlhorky/migrate-repo-to-lfs.sh
Migrate existing design git repo to large file storage with history
git filter-branch --prune-empty --tree-filter '
git lfs track "*.bsp"
git lfs track "*.vtf"
git lfs track "*.wav"
git lfs track "*.mp3"
git lfs track "*.mdl"
git lfs track "*.vtx"
git lfs track "*.vvd"
git lfs track "*.phy"
git lfs track "*.bik"
@thexa4
thexa4 / vps.init.sh
Last active September 16, 2016 20:40
apt-get update
apt-get dist-upgrade --yes
apt-get install lsb-release ca-certificates --yes
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-jessie.deb
dpkg -i puppetlabs-release-pc1-jessie.deb
apt-get update
apt-get install puppet-agent --yes
/opt/puppetlabs/bin/puppet agent --test --waitforcert 30