#!/bin/bash

# repos I still love and am proud of
repos: makefile
	rm -r -f repos
	mkdir repos
	cd repos && git clone https://git.nunosempere.com/NunoSempere/2024-election-modelling
	cd repos && git clone https://git.nunosempere.com/NunoSempere/fermi
	cd repos && git clone https://git.nunosempere.com/open.source/pass-append
	cd repos && git clone https://git.nunosempere.com/personal/lemarios
	cd repos && git clone https://git.nunosempere.com/personal/pomo
	cd repos && git clone https://git.nunosempere.com/personal/squiggle.c
	cd repos && git clone https://git.nunosempere.com/personal/wc
	cd repos && git clone https://github.com/NunoSempere/german-pronouns.git
	cd repos && git clone https://github.com/NunoSempere/labeling
	cd repos && git clone https://github.com/NunoSempere/longnow-for-markdown
	cd repos && git clone https://github.com/NunoSempere/mumble
	cd repos && git clone https://github.com/NunoSempere/nsnvm
	cd repos && git clone https://github.com/NunoSempere/predict-resolve-tally
	cd repos && git clone https://github.com/NunoSempere/reverse-shooting
	cd repos && git clone https://github.com/NunoSempere/rosenrot-browser
	cd repos && git clone https://github.com/NunoSempere/shapleyvalue.com
	cd repos && git clone https://github.com/NunoSempere/time-to-botec
	cd repos && git clone https://github.com/NunoSempere/update-discord
	cd repos && git clone https://github.com/NunoSempere/werc-1.5.0-tweaks
	# cd repos && git clone https://github.com/quantified-uncertainty/fit-beta
	cd repos && git clone https://github.com/quantified-uncertainty/metaforecast 
	cd repos && git clone https://github.com/quantified-uncertainty/simple-squiggle

descriptions:
	echo "A walking stick to Nate Silver's sportscar" > repos/2024-election-modelling/.git/description
	echo "A minimalist calculator for estimating with distributions" > repos/fermi/.git/description
	echo "Get the gender of German pronouns" > repos/german-pronouns/.git/description
	echo "Axis labeling algorithms for R, used in ggplot" > repos/labeling/.git/description
	echo "Listas de palabras en español" > repos/lemarios/.git/description
	echo "Take a markdown file and feed links to the internet archive" > repos/longnow-for-markdown/.git/description
	echo "A Lisp written in C, following the *Build Your Own Lisp* book" > repos/mumble/.git/description
	echo "Nuño's stupid node version manager, because nvm was too slow" > repos/nsnvm/.git/description
	echo "An extension for pass" > repos/pass-append/.git/description
	echo "A simple pomodoro timer" > repos/pomo/.git/description
	echo "Predictions in 57 lines of code" > repos/predict-resolve-tally/.git/description
	echo "Matlab scripts for reverse shooting" > repos/reverse-shooting/.git/description
	echo "A hackable browser based on Webkitgtk" > repos/rosenrot-browser/.git/description
	echo "Attribute value according to a parsimonious game theory solution" > repos/shapleyvalue.com/.git/description
	echo "Update Discord on Debian-based distributions" > repos/update-discord/.git/description
	echo "Tweaks for the werc website builder created by the mad architect Uriel" > repos/werc-1.5.0-tweaks/.git/description
	echo "Find a beta distribution which fits a desired confidence interval" > repos/fit-beta/.git/description
	echo "Self-contained Monte Carlo estimation in C99" > repos/squiggle.c/.git/description
	echo "Benchmark sampling in different programming languages" > repos/time-to-botec/.git/description
	echo "Count words in <50 lines of C" > repos/wc/.git/description
	echo "Search forecasts from many different platforms 2021-2024" > repos/metaforecast/.git/description 
	echo "A restricted subset of Squiggle" > repos/simple-squiggle/.git/description

owner:
	echo NunoSempere > repos/2024-election-modelling/.git/owner
	echo NunoSempere > repos/fermi/.git/owner
	echo NunoSempere > repos/fit-beta/.git/owner
	echo NunoSempere > repos/german-pronouns/.git/owner
	echo NunoSempere > repos/labeling/.git/owner
	echo NunoSempere > repos/lemarios/.git/owner
	echo NunoSempere > repos/longnow-for-markdown/.git/owner
	echo NunoSempere > repos/mumble/.git/owner
	echo NunoSempere > repos/nsnvm/.git/owner
	echo NunoSempere > repos/pass-append/.git/owner
	echo NunoSempere > repos/pomo/.git/owner
	echo NunoSempere > repos/predict-resolve-tally/.git/owner
	echo NunoSempere > repos/reverse-shooting/.git/owner
	echo NunoSempere > repos/rosenrot-browser/.git/owner
	echo NunoSempere > repos/shapleyvalue.com/.git/owner
	echo NunoSempere > repos/squiggle.c/.git/owner
	echo NunoSempere > repos/time-to-botec/.git/owner
	echo NunoSempere > repos/update-discord/.git/owner
	echo NunoSempere > repos/wc/.git/owner
	echo NunoSempere > repos/werc-1.5.0-tweaks/.git/owner
	echo NunoSempere > repos/metaforecast/.git/owner
	echo NunoSempere > repos/simple-squiggle/.git/owner

html: makefile 
	rm -r html
	mkdir html 
	cd html && mkdir 2024-election-modelling && cd 2024-election-modelling && stagit ../../repos/2024-election-modelling 
	cd html && mkdir fermi && cd fermi && stagit ../../repos/fermi 
	# cd html && mkdir fit-beta && cd fit-beta && stagit ../../repos/fit-beta
	cd html && mkdir labeling && cd labeling && stagit ../../repos/labeling 
	cd html && mkdir lemarios && cd lemarios && stagit ../../repos/lemarios 
	cd html && mkdir longnow-for-markdown && cd longnow-for-markdown && stagit ../../repos/longnow-for-markdown 
	cd html && mkdir mumble && cd mumble && stagit ../../repos/mumble 
	cd html && mkdir nsnvm && cd nsnvm && stagit ../../repos/nsnvm 
	cd html && mkdir pass-append && cd pass-append && stagit ../../repos/pass-append 
	cd html && mkdir pomo && cd pomo && stagit ../../repos/pomo 
	cd html && mkdir predict-resolve-tally && cd predict-resolve-tally && stagit ../../repos/predict-resolve-tally 
	cd html && mkdir reverse-shooting && cd reverse-shooting && stagit ../../repos/reverse-shooting 
	cd html && mkdir rosenrot-browser && cd rosenrot-browser && stagit ../../repos/rosenrot-browser 
	cd html && mkdir shapleyvalue.com && cd shapleyvalue.com && stagit ../../repos/shapleyvalue.com 
	cd html && mkdir squiggle.c && cd squiggle.c && stagit ../../repos/squiggle.c 
	cd html && mkdir time-to-botec && cd time-to-botec && stagit ../../repos/time-to-botec 
	cd html && mkdir update-discord && cd update-discord && stagit ../../repos/update-discord
	cd html && mkdir wc && cd wc && stagit ../../repos/wc 
	cd html && mkdir werc-1.5.0-tweaks && cd werc-1.5.0-tweaks && stagit ../../repos/werc-1.5.0-tweaks
	cd html && mkdir metaforecast && cd metaforecast && stagit ../../repos/metaforecast 
	cd html && mkdir simple-squiggle && cd simple-squiggle && stagit ../../repos/simple-squiggle 


css: makefile
	cp style.css html
	cp style.css html/2024-election-modelling
	cp style.css html/fermi
	# cp style.css html/fit-beta
	cp style.css html/german-pronouns
	cp style.css html/labeling
	cp style.css html/lemarios
	cp style.css html/longnow-for-markdown
	cp style.css html/mumble
	cp style.css html/nsnvm
	cp style.css html/pass-append
	cp style.css html/pomo
	cp style.css html/predict-resolve-tally
	cp style.css html/reverse-shooting
	cp style.css html/rosenrot-browser
	cp style.css html/shapleyvalue.com
	cp style.css html/squiggle.c
	cp style.css html/time-to-botec
	cp style.css html/update-discord
	cp style.css html/wc
	cp style.css html/werc-1.5.0-tweaks
	cp style.css html/metaforecast
	cp style.css html/simple-squiggle

logo: makefile
	cp logo.png html
	cp logo.png html/2024-election-modelling
	cp logo.png html/fermi
	# cp logo.png html/fit-beta
	cp logo.png html/german-pronouns
	cp logo.png html/labeling
	cp logo.png html/lemarios
	cp logo.png html/longnow-for-markdown
	cp logo.png html/mumble
	cp logo.png html/nsnvm
	cp logo.png html/pass-append
	cp logo.png html/pomo
	cp logo.png html/predict-resolve-tally
	cp logo.png html/reverse-shooting
	cp logo.png html/rosenrot-browser
	cp logo.png html/shapleyvalue.com
	cp logo.png html/squiggle.c
	cp logo.png html/time-to-botec
	cp logo.png html/update-discord
	cp logo.png html/wc
	cp logo.png html/werc-1.5.0-tweaks
	cp logo.png html/metaforecast
	cp logo.png html/simple-squiggle

index: makefile
	cd html && stagit-index ../repos/2024-election-modelling ../repos/fermi ../repos/labeling ../repos/lemarios ../repos/longnow-for-markdown ../repos/mumble ../repos/nsnvm ../repos/pass-append ../repos/pomo ../repos/predict-resolve-tally ../repos/reverse-shooting ../repos/rosenrot-browser ../repos/shapleyvalue.com ../repos/squiggle.c ../repos/time-to-botec ../repos/wc ../repos/update-discord ../repos/german-pronouns ../repos/werc-1.5.0-tweaks ../repos/metaforecast ../repos/simple-squiggle > index.html 

view:
	rosenrot "file://$$(realpath html/index.html)"

most:
	make descriptions
	make owner
	make html
	make css
	make logo
	make index
	make view

# Somehow don't seem good enough
# NunOS?
# Utility function extractor?
# Server init?
# Open Phil funding?
# git clone https://github.com/NunoSempere/memo
# https://github.com/NunoSempere/Knuth-Morris-Pratt
# https://github.com/NunoSempere/Turing_Machine
# https://github.com/NunoSempere/nunosempere.com
# https://git.nunosempere.com/open.source/pass-reveal
# https://git.nunosempere.com/personal/compute-constrained-bayes

# Have loved, but don't want to make public
# Analyze-news
# Forum frontend
# nunosempere.com?
# My .bashrc? Nope, has 
# Forum snippets

# Others I hadn't found yet
# https://github.com/SamotsvetyForecasting/optimal-scoring
# nunosempere.com?
# https://github.com/NunoSempere/commandificator
# https://github.com/NunoSempere/Online-Appendix-to-Incentive-Problems-In-Forecasting-Tournaments
# https://github.com/NunoSempere/Radamantis
# https://github.com/NunoSempere/Tres-en-raya
# https://github.com/NunoSempere/Online-Appendix-to-Incentive-Problems-In-Forecasting-Tournaments
#