Skip to content

Instantly share code, notes, and snippets.

@beccasaurus
beccasaurus / : Reading Mech data from MegaMek.md
Last active April 5, 2023 18:33
Reading Mech data from MegaMek

Reading Mech data from MegaMek

MegaMek is licensed under the GNU General Public License v2.0

Therefore, this code is also licensed under GPLv2

The BattleTech IP is owned by The Topps Company, Inc and is licensed by Catalyst Game Labs.
The main website for BattleTech is here - BattleTech: The Board Game of Armored Combat

The MegaMek/megamek repository contains thousands of .mtf files containing definitions for BattleTech mechs and their information, e.g. this file defining the [Marauder 3R](https://github.com/MegaMek/megamek/blob/master/megamek/data/mechfi

@beccasaurus
beccasaurus / Get STDOUT and STDERR in Separate Variables.sh
Last active May 7, 2021 18:24
Get STDOUT and STDERR in Separate Variables
#! /usr/bin/env bash
foo() {
echo "STDOUT contents (called with args $*)"
echo "STDERR contents (called with args $*)" >&2
return 42
}
printOutBothStdoutAndStderrSeparately() {
echo "$({
@beccasaurus
beccasaurus / goto.sh
Last active April 28, 2021 21:33
goto.sh
GOTO_PROJECT_ROOTS=("${MY_PROMPT_HOME:-$HOME}/Code")
GOTO_VERBOSE=true
goto() {
if (( $# == 0 ))
then
cd "${GOTO_PROJECT_ROOTS[0]}"
return 0
fi
(( $# < 1 )) && return 1
@beccasaurus
beccasaurus / PS1.sh
Last active April 29, 2021 00:09
My PS1
MY_PROMPT_HOSTNAMES=(
"beccabox:🐧"
"winvm:🕹️"
)
MY_PROMPT_HOME="$HOME"
[ -d /cygdrive/b ] && MY_PROMPT_HOME=/cygdrive/b
MY_PROMPT_FOLDERS=(
"$MY_PROMPT_HOME/Code/beccasaurus/minispec-main:💻 🦖 🧫 ⇪"
require "json"
require "csv"
weapons = JSON.parse File.read("weapons.json")
column_names = File.read("column_names").split "\t"
csv = CSV.generate do |csv|
weapons.keys.each do |weapon_name|
30.times do |i|
csv << column_names.map do |column_name|
#! /bin/bash
trap 'echo "Exiting..."; exit 1' SIGINT
up='[A'
down='[B'
right='[C'
left='[D'
special=""
@beccasaurus
beccasaurus / Gemfile
Created June 23, 2020 04:49
Simple Ruby Websockets
source 'http://rubygems.org'
gem 'em-http-request', :require => 'em-http'
gem 'em-websocket'
@beccasaurus
beccasaurus / My Roll20 Macros.md
Last active May 22, 2020 06:45
Roll20 Macros

API Scripts

First, go to your API Scripts and enable these two:

  • TokenMod
  • GroupInitiative (ignore the warning popup when adding this one, it's fine)

Then open up the Macros section.

  • 🗸 Show macro quick bar
@beccasaurus
beccasaurus / Synthesis Complete.
Created November 21, 2019 20:44
say -v Daniel "Synthesis Complete."
say -v Daniel "Synthesis Complete."
@beccasaurus
beccasaurus / sample_tester.sh
Last active September 30, 2019 12:00
sample-tester avec la couleur
sample_tester() {
echo "Running: sample-tester -v detailed $*"
# Escape sequene
local esc=$(printf '\033')
sample-tester -v detailed "$@" 2>&1 | \
sed "s/Tests failed/${esc}[31mTests failed${esc}[0m/g" | \
sed "s/Tests passed/${esc}[32mTests passed${esc}[0m/g" | \
sed "s/# ... call did not succeed \(.*\)/${esc}[90m# ${esc}[31m\`call:\` failed: \1${esc}[0m/g" | \