Skip to content

Instantly share code, notes, and snippets.

View autocorr's full-sized avatar

Brian Svoboda autocorr

View GitHub Profile
# knight / commoner
# cannon / alfil
# rook / fers
# bishop / wazir
# queen / hopper
[biwakoshogi]
maxRank = 8
maxFile = 8
king = k
knight = n
@autocorr
autocorr / run_gen
Created February 15, 2024 20:23
Fairy-Stockfish puzzler scripts
#!/usr/bin/env bash
FSF=../fstockfish_bmi_lb
INI=../my_variants.ini
VARIANT=gethenian
NNUE=../nnue/${VARIANT}_l0.5_v1.nnue
BOOK=../books/strong_books/${VARIANT}.epd
COUNT=100000 # number of positions
OUTNAME="$VARIANT"_n"$COUNT".epd
@autocorr
autocorr / run_datagen
Created August 24, 2023 14:49
Example script for running the `variant-nnue-tools` Fairy-Stockfish data generation
#!/usr/bin/env bash
VARIANT=khans
FSF=./fstockfish_bmi
INI=../variants_pychess.ini
NNUE=../nnue/chennis_old.nnue
OUTNAME="$VARIANT"_data_v1.bin
THREADS=20
DEPTH=6
COUNT="$(echo '1 000 000 000' | tr -d ' ')"
@autocorr
autocorr / rotate_svgs
Created August 17, 2023 19:24
Rotate a set of SVGs by 180 degrees using Inkscape.
#!/bin/bash
for input_file in *.svg
do
stem="${input_file%%.*}"
outname="${stem}_r"
inkscape --actions "select-all;transform-rotate:180;export-filename:${outname}.svg;export-do" $input_file
done
@autocorr
autocorr / hopperrace.epd
Created June 17, 2023 02:49
Opening book in EPD format generated for Hopper Race
This file has been truncated, but you can view the full file.
1slggls1/8/1pppppp1/8/8/1PPPPPP1/8/1SLGGLS1 w - - 0 1
1slggls1/8/1pppppp1/8/5P2/1PPPPP2/8/1SLGGLS1 b - - 1 1
2lggls1/2s5/1pppppp1/8/5P2/1PPPPP2/8/1SLGGLS1 w - - 2 2
2lggls1/2s5/1pppppp1/8/5P2/1PPPPP2/2S5/2LGGLS1 b - - 3 2
2l1gls1/2s1g3/1pppppp1/8/5P2/1PPPPP2/2S5/2LGGLS1 w - - 4 3
2lggls1/2s5/1pp1ppp1/3p4/5P2/1PPPPP2/2S5/2LGGLS1 w - - 4 3
2lggls1/2s5/1ppp1pp1/4p3/5P2/1PPPPP2/2S5/2LGGLS1 w - - 4 3
2lggls1/2s5/1pppppp1/8/5P2/1PPPPP2/5S2/1SLGGL2 b - - 3 2
2lggl2/2s2s2/1pppppp1/8/5P2/1PPPPP2/5S2/1SLGGL2 w - - 4 3
2lggls1/2s5/1pp1ppp1/3p4/5P2/1PPPPP2/5S2/1SLGGL2 w - - 4 3
@autocorr
autocorr / hopper_race.ini
Last active June 19, 2023 21:12
Fairy-Stockfish variant file for Hopper Race.
[hopperrace]
maxRank = 8
maxFile = 8
gold = g
silver = s
queen = f # flag piece used for mandatory promotion
customPiece1 = l:mfFmfWmgQ # non-capturing hopper
customPiece2 = p:fFmfW # breakthrough pawn
startFen = 1slggls1/8/1pppppp1/8/8/1PPPPPP1/8/1SLGGLS1 w - - 0 1
extinctionValue = loss
@autocorr
autocorr / noise_and_heat.py
Created March 28, 2023 23:06
Create a concatenated colorbar. Useful for "grayscale plus heat."
# By Eric Koch
def half_table(table1_name, table2_name,
reverse1=False, reverse2=False,
pivot=0.5):
"""
Splice together two matplotlib color tables.
"""
n_col = 256
cmap1 = cm.get_cmap(table1_name, n_col)
@autocorr
autocorr / test_getregion_leak.py
Last active April 29, 2021 03:28
CASA v5 script to test memory leak in `ia.getregion`
#!/usr/bin/env python
"""
Execute tests to reproduce memory leaks from `ia.getregion`. See the functions
under the "Tests" banner near the bottom of the module for the tests to run.
Images with diameters in pixels greater than or equal to 3500 appear to cause
memory leaks. By default 50 calls are made to `ia.getregion`. The call itself
selects a bounding box encompassing the full image and selects one channel (the
second channel).
This file is meant to be run using `execfile` under CASA v5 and Python v2.7.
@autocorr
autocorr / sparse_argus_map.py
Created February 4, 2020 20:10
Hacky coverage analysis for GBT/Argus
#!/usr/bin/env python3
import itertools
import numpy as np
from matplotlib import patches
from matplotlib import pyplot as plt
from astropy import units as u
@autocorr
autocorr / ripple_tank_demos.txt
Last active June 7, 2021 18:13
Ripple tank demos for radio astronomy and interferometry
# Ripple Tank Demos
Website available at: http://www.falstad.com/ripple/ . Copy and paste the following entries
by going under "File -> Import From Text...", beginning from the "$" until the blank line.
One can use the two check-boxes on the right to stop the simulation and visualize the
amplitdues in 3D. The sliders on the right can be used to adjust the rate/speed of the
simulation and wavelength/frequency of the wave (under "Source Frequency").
Single point source. Point source limits to plane wave.
$ 1 512 64 10 0 668 0.048828125
s 2 257 45 0 0.466666 0 10 100 1 0