Skip to content

Instantly share code, notes, and snippets.

View DOsinga's full-sized avatar

Douwe Osinga DOsinga

View GitHub Profile
@DOsinga
DOsinga / Errors.gs
Created February 16, 2024 22:54
Implements throw_error_(msg, line) that will show in Apps script an error at the specified line by implementing 10k functions
function err_1_(message) { throw new Error(message); }
function err_2_(message) { throw new Error(message); }
function err_3_(message) { throw new Error(message); }
function err_4_(message) { throw new Error(message); }
function err_5_(message) { throw new Error(message); }
function err_6_(message) { throw new Error(message); }
function err_7_(message) { throw new Error(message); }
function err_8_(message) { throw new Error(message); }
function err_9_(message) { throw new Error(message); }
function err_10_(message) { throw new Error(message); }
#! /bin/bash
while IFS="," read -r state_name landmark state_code rec_remaining
do
echo "Run: $state_name \"$landmark\" $state_code"
if [ ! -f outputs/landmarks/$state_code.png ];
then
python scripts/txt2img.py --prompt "a travel magazine photo by Chris Burkard of $landmark, $state_name, trending on artstation" --n_samples 1 --n_iter 1 --plms --outdir outputs/landmarks
mv outputs/landmarks/grid-*.png outputs/landmarks/$state_code.png
fi
State Landmark State code x y
California The Golden Gate Bridge CA 0 4
Alaska Denali National Park AK 0 0
New York The Statue of Liberty NY 8 2
Colorado Mesa Verde National Park CO 2 4
Alabama Birmingham Civil Rights Institute AL 6 6
Arizona Grand Canyon National Park AZ 1 5
Arkansas The Ozarks AR 4 5
Connecticut Yale University Art Gallery CT 9 3
Delaware The Lewes Beach DE 9 4
from datetime import date, timedelta
from collections import Counter
# all the dates that fit the equation:
dates = [*filter(lambda d:d.year - 2000 == d.month * d.day, [date(2001, 1, 1) + timedelta(i) for i in range(36158)])]
# total events is number of dates:
print(len(dates))
# Counter.most_common is the year that occurs most: