Skip to content

Instantly share code, notes, and snippets.

@rpunt
rpunt / profiles.json
Created March 29, 2020 17:35
Microsoft Terminal configuration
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"globals": {
"alwaysShowTabs": true,
"initialCols": 120,
"initialRows": 30,
@rpunt
rpunt / hamilton.sh
Last active July 19, 2020 13:31
Did Hamilton win the race?
function hamilton() {
results=$(curl -s https://www.formula1.com/en/results.html/$(date +%Y)/races.html)
gp=$(echo "$results" | nokogiri -e 'puts $_.at_xpath("//table[@class=\"resultsarchive-table\"]/tbody/tr[last()]/td[2]/a").text.strip' 2>/dev/null)
date=$(echo "$results" | nokogiri -e 'puts $_.at_xpath("//table[@class=\"resultsarchive-table\"]/tbody/tr[last()]/td[3]").text' 2>/dev/null)
winner=$(echo "$results" | nokogiri -e 'puts $_.at_xpath("//table[@class=\"resultsarchive-table\"]/tbody/tr[last()]/td[4]/span[2]").text' 2>/dev/null | tr 'A-Z' 'a-z')
echo -e "Did Hamilton win?\n${gp}: ${date}\n"
if [ "$winner" == "hamilton" ]; then
echo "YES. I'm guessing Ferrari botched team orders, and Williams probably came last."
else
echo "NO. ANYTHING IS POSSIBLE. REVEL IN THE UNPREDICTABLITY OF LIFE."
@rpunt
rpunt / gitchanges.sh
Created July 25, 2020 22:13
Has something changed in a local git repo?
if ! git diff-index --quiet HEAD --; then
echo "I have changes to be pushed"
fi
@rpunt
rpunt / wslsetup.ps1
Last active November 5, 2021 13:26
wslsetup.ps1
if (((wsl -l --all) | Where-Object { $_ -like "Ubuntu-20.04" }).Length -eq 0) {
wsl --install --distribution Ubuntu-20.04
}
RefreshEnv
ubuntu2004.exe run sudo apt-get install -y software-properties-common
ubuntu2004.exe run sudo apt-add-repository -y ppa:rael-gc/rvm
ubuntu2004.exe run sudo apt-get update
ubuntu2004.exe run sudo apt-get install rvm