Skip to content

Instantly share code, notes, and snippets.

View edward3h's full-sized avatar

Edward Harman edward3h

View GitHub Profile
@edward3h
edward3h / capture.sh
Created July 19, 2021 15:01
Hacky script to create summarized datasheet file
#!/bin/bash
# depends on https://github.com/sindresorhus/capture-website-cli
# npm install --global capture-website-cli
BASE=https://wahapedia.ru/wh40k9ed/factions/craftworlds/
UNITS="Avatar-of-Khaine Farseer Warlock Dire-Avengers Guardian-Defenders Rangers Striking-Scorpions Warp-Spiders Phoenix Dark-Reapers War-Walkers Wraithlord"
echo "<html><style>img {width:100%;}.unit{width:80%;margin: auto;margin-bottom: 1em;}</style><body>" > index.html
for u in $UNITS; do
@edward3h
edward3h / generate_characters_sprite.groovy
Created April 14, 2021 15:04
generate a Sprite file for Scratch 3, where each costume is a letter or other character
import java.util.zip.*
import groovy.json.*
def sprite = [
isStage: false,
name: 'letters',
variables: [:],
lists: [:],
broadcasts: [:],
blocks: [:],
import java.util.zip.*
import groovy.json.*
def sprite = [
isStage: false,
name: "letters",
variables: [:],
lists: [:],
broadcasts: [:],
blocks: [:],
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@edward3h
edward3h / Blink.cpp
Created January 25, 2021 15:22
Arduino: learning to use TaskScheduler
@edward3h
edward3h / interim_temp.service
Created January 9, 2021 14:35
hacky service setup for f007th-rpi
# command line to install
sudo systemctl enable $PWD/interim_temp.service
sudo systemctl start interim_temp
@edward3h
edward3h / fusion_vs_quantum.rb
Created October 6, 2020 18:41
compare damage output of old/new fusion/melta vs old/new Quantum Shielding rules
#!/usr/bin/env ruby
require_relative 'stats'
def run_test(ndice)
acc = []
0.upto((6 ** ndice) - 1) do |dscore|
ds = dscore.to_s(6).rjust(ndice,'0').split(//).map{|s| s.to_i + 1}
v = yield(ds)
acc << v
end
@edward3h
edward3h / localviz.bash
Last active August 21, 2020 13:42
Glue script for Mac OS X - find latest Minecraft (mcpelauncher) world, generate bedrock-viz map, open it in browser
#!/bin/bash
# Homebrew dependencies for Mac:
# brew tap bedrock-viz/tap
# brew install coreutils findutils bedrock-viz
#
# Also depends on docker
# lazy error handling :-P
set -e
@edward3h
edward3h / CSM_vs_CSM.rb
Created July 11, 2017 18:27
Simple example of 40k unit simulation. See https://www.reddit.com/r/Warhammer/comments/6mn9t7/mathhammer_csm_vs_csm/ for inspiration.
#!/usr/bin/env ruby
$experiments = 10000
# distance fudging - assume distance X is "within X" for rules purposes
$startRange = 24
$range = $startRange
$attemptChargeRange = 10
$rounds = 5
@edward3h
edward3h / CSM_vs_CSM.rb
Created July 11, 2017 18:27
Simple example of 40k unit simulation. See https://www.reddit.com/r/Warhammer/comments/6mn9t7/mathhammer_csm_vs_csm/ for inspiration.
#!/usr/bin/env ruby
$experiments = 10000
# distance fudging - assume distance X is "within X" for rules purposes
$startRange = 24
$range = $startRange
$attemptChargeRange = 10
$rounds = 5