first

+3
README.md
···
+
# misc scripts & programs
+
+
some of these are also in my dotfiles. whatever
+9
getlyr
···
+
#!/bin/bash
+
+
artist=$(gum input --placeholder artist | awk '{$1=$1}1' OFS="+")
+
+
song=$(gum input --placeholder song | awk '{$1=$1}1' OFS="+")
+
+
echo -e $(gum style --italic --foreground "#f4b8e4" "'$artist', '$song'")
+
+
curl -s https://api.lyrics.ovh/v1/"$artist"/"$song" | jq -r .lyrics | less
+10
lastfm.py
···
+
import urllib.request
+
import json
+
url = 'https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${USER}&api_key=${API_KEY}&format=json&limit=1'
+
req = urllib.request.Request(url)
+
+
slay = urllib.request.urlopen(req).read()
+
stuff = json.loads(slay.decode('utf-8'))
+
+
for item in stuff['recenttracks']['track'][:1]:
+
print(item['artist']['#text'],"\n ", item['album']['#text'],"\n ", item['name'])
+54
marvel
···
+
#!/bin/bash
+
#
+
# unfinished weird little thing i was playing with to query the marvel API
+
+
API_KEY=x
+
PRIV_KEY=x
+
TS=1
+
HASH=$(echo -n ${TS}${PRIV_KEY}${API_KEY} | md5sum | cut -d ' ' -f 1)
+
+
echo -e "what do you want to look up? \n"
+
+
CHOOSE=$(gum choose --limit 1 "characters" "comics" "creators")
+
+
echo -e "what do you want to look up from ${CHOOSE}? \n"
+
+
LOOK=$(gum input --placeholder "type away")
+
+
URL="https://gateway.marvel.com/v1/public/${CHOOSE}?${TYPE}=${LOOK}&apikey=${API_KEY}&ts=${TS}&hash=${HASH}"
+
+
if [ "${CHOOSE}" == "characters" ]; then
+
echo -e "pick from below \n"
+
TYPE="name"
+
CHARA=$(gum choose --limit 1 "comics" "series" "events")
+
case ${CHARA} in
+
comics)
+
echo -n -e "comics starring ${LOOK}: \n\n"
+
curl -s ${URL} | jq -r ".data.results[].comics.items[].name"
+
;;
+
series)
+
echo -n -e "series starring ${LOOK}: \n\n"
+
curl -s ${URL} | jq -r ".data.results[].series.items[].name"
+
;;
+
events)
+
echo -n -e "events starring ${LOOK}: \n\n"
+
curl -s ${URL} | jq -r ".data.results[].events.items[].name"
+
;;
+
esac
+
elif [ "$CHOOSE" == "comics" ]; then
+
echo -e "pick from below \n"
+
TYPE="title"
+
COMIC=$(gum choose --limit 1 "title" "description")
+
case ${COMIC} in
+
title)
+
echo -n -e "comics featuring ${LOOK}: \n\n"
+
curl -s ${URL} | jq -r ".data.results[].title"
+
;;
+
description)
+
echo -n -e "comic descriptions with ${LOOK}: \n\n"
+
curl -s ${URL} | jq -r ".data.results[].description"
+
;;
+
esac
+
else
+
echo -e "did you hit ctrl+c"
+
fi
+13
md2html
···
+
#!/bin/bash
+
#
+
# generates an HTML file from a supplied MD file in the current working directory
+
#
+
# uses a custom pandoc template
+
+
FILE=$(gum input --placeholder "without an extension")
+
+
HTML="pandoc/md2html.html"
+
+
CSS="pandoc/md2html.css"
+
+
pandoc --standalone "$FILE.md" --template=$HTML --no-highlight -o "$FILE.html"
+22
nowplaying
···
+
#!/bin/bash
+
+
apikey=""
+
+
user=""
+
+
URL="https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=$user&api_key=$apikey&format=json&limit=1"
+
+
artist=$(curl -s ${URL} | jq -r '.recenttracks.track[0].artist."#text"')
+
album=$(curl -s ${URL} | jq -r '.recenttracks.track[0].album."#text"')
+
song=$(curl -s ${URL} | jq -r '.recenttracks.track[0].name')
+
+
left=$(printf "%s\n%s\n%s\n" "artist" "album" "song")
+
right=$(printf "%s\n%s\n%s\n" "$artist" "$album" "$song")
+
+
final_left=$(gum style --foreground "#a6d189" --border none --width 20 --margin "1 2" --padding "0 1" --align left "$left")
+
final_right=$(gum style --foreground "#f4b8e4" --border none --width 20 --margin "1 0" --align left "$right")
+
+
join=$(gum join --horizontal --align right "$final_left" "$final_right")
+
all=$(gum style --border-foreground "#99d1db" --border double --width 50 --padding "0 1" --align center "$join")
+
+
gum join --vertical "$all"
+171
pandoc/md2html.css
···
+
@import url('https://unpkg.com/@catppuccin/palette/css/catppuccin.css');
+
html {
+
color: var(--ctp-frappe-base);
+
background-color: var(--ctp-latte-base);
+
}
+
body {
+
margin: 0 auto;
+
max-width: 50%;
+
padding-left: 50px;
+
padding-right: 50px;
+
padding-top: 50px;
+
padding-bottom: 50px;
+
hyphens: auto;
+
overflow-wrap: break-word;
+
text-rendering: optimizeLegibility;
+
font-kerning: normal;
+
}
+
@media (max-width: 600px) {
+
body {
+
font-size: 0.9em;
+
padding: 12px;
+
max-width: 100%;
+
}
+
h1 {
+
font-size: 1.8em;
+
}
+
}
+
@media print {
+
html {
+
background-color: white;
+
}
+
body {
+
background-color: transparent;
+
color: black;
+
font-size: 12pt;
+
}
+
p, h2, h3 {
+
orphans: 3;
+
widows: 3;
+
}
+
h2, h3, h4 {
+
page-break-after: avoid;
+
}
+
}
+
p {
+
margin: 1em 0;
+
}
+
a, a:link, a:visited, a:link:visited {
+
color: var(--ctp-latte-lavender);
+
}
+
a:hover {
+
text-decoration: none;
+
color: var(--ctp-latte-text);
+
}
+
img {
+
max-width: 100%;
+
}
+
svg {
+
height: auto;
+
max-width: 100%;
+
}
+
h1, h2, h3, h4, h5, h6 {
+
margin-top: 1.4em;
+
color: var(--ctp-frappe-surface0);
+
}
+
h5, h6 {
+
font-size: 1em;
+
font-style: italic;
+
}
+
h6 {
+
font-weight: normal;
+
}
+
ol, ul {
+
padding-left: 1.7em;
+
margin-top: 1em;
+
}
+
li > ol, li > ul {
+
margin-top: 0;
+
}
+
blockquote {
+
margin: 1em 0 1em 1.7em;
+
padding-left: 1em;
+
border-left: 2px solid #e6e6e6;
+
color: #606060;
+
}
+
code {
+
font-family: Menlo, Monaco, Consolas, 'Lucida Console', monospace;
+
font-size: 85%;
+
margin: 0;
+
hyphens: manual;
+
}
+
pre {
+
margin: 1em 0;
+
overflow: auto;
+
padding: 1em;
+
background: #303446;
+
}
+
pre code {
+
padding: 0;
+
overflow: visible;
+
overflow-wrap: normal;
+
}
+
.sourceCode {
+
background-color: transparent;
+
overflow: visible;
+
}
+
hr {
+
background-color: #1a1a1a;
+
border: none;
+
height: 1px;
+
margin: 1em 0;
+
}
+
table {
+
margin: 1em 0;
+
border-collapse: collapse;
+
width: 100%;
+
overflow-x: auto;
+
display: block;
+
font-variant-numeric: lining-nums tabular-nums;
+
}
+
table caption {
+
margin-bottom: 0.75em;
+
}
+
tbody {
+
margin-top: 0.5em;
+
border-top: 1px solid #1a1a1a;
+
border-bottom: 1px solid #1a1a1a;
+
}
+
th {
+
border-top: 1px solid #1a1a1a;
+
padding: 0.25em 0.5em 0.25em 0.5em;
+
}
+
td {
+
padding: 0.125em 0.5em 0.25em 0.5em;
+
}
+
header {
+
margin-bottom: 4em;
+
text-align: center;
+
}
+
#TOC li {
+
list-style: none;
+
}
+
#TOC ul {
+
padding-left: 1.3em;
+
}
+
#TOC > ul {
+
padding-left: 0;
+
}
+
#TOC a:not(:hover) {
+
text-decoration: none;
+
}
+
code{white-space: pre-wrap;}
+
span.smallcaps{font-variant: small-caps;}
+
div.columns{display: flex; gap: min(4vw, 1.5em);}
+
div.column{flex: auto; overflow-x: auto;}
+
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
+
/* The extra [class] is a hack that increases specificity enough to
+
override a similar rule in reveal.js */
+
ul.task-list[class]{list-style: none;}
+
ul.task-list li input[type="checkbox"] {
+
font-size: inherit;
+
width: 0.8em;
+
margin: 0 0.8em 0.2em -1.6em;
+
vertical-align: middle;
+
}
+
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
+
+
::selection {
+
color: var(--ctp-latte-surface1);
+
background: var(--ctp-frappe-crust);
+
}
+87
pandoc/md2html.html
···
+
<!DOCTYPE html>
+
<html lang="en">
+
<head>
+
<meta charset="utf-8" />
+
<meta name="generator" content="pandoc" />
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
+
$for(author-meta)$
+
<meta name="author" content="$author-meta$" />
+
$endfor$
+
$if(date-meta)$
+
<meta name="dcterms.date" content="$date-meta$" />
+
$endif$
+
$if(keywords)$
+
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
+
$endif$
+
$if(description-meta)$
+
<meta name="description" content="$description-meta$" />
+
$endif$
+
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
+
+
<link rel="stylesheet" href="https://unpkg.com/@catppuccin/highlightjs@1.0.1/css/catppuccin-frappe.css">
+
+
<link rel="stylesheet" href="../md2html.css">
+
+
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.9.0/highlight.min.js"></script>
+
+
<script>
+
document.getElementById("sourceCode").classList.add("language ");
+
</script>
+
+
$for(header-includes)$
+
$header-includes$
+
$endfor$
+
$if(math)$
+
$math$
+
$endif$
+
</head>
+
<body>
+
<script>hljs.highlightAll();</script>
+
$for(include-before)$
+
$include-before$
+
$endfor$
+
$if(title)$
+
<header id="title-block-header">
+
<h1 class="title">$title$</h1>
+
$if(subtitle)$
+
<p class="subtitle">$subtitle$</p>
+
$endif$
+
<p>
+
$if(date)$
+
published <span class="date">$date$</span>
+
$endif$
+
</p>
+
<p>
+
$if(lastmodified)$
+
last edited <span class="date">$lastmodified$</span>
+
$endif$
+
</p>
+
<p>
+
$for(author)$
+
by <a href="https://girlonthemoon.xyz/"><span class="author">$author$</span></a>
+
$endfor$
+
</p>
+
$if(abstract)$
+
<div class="abstract">
+
<div class="abstract-title">$abstract-title$</div>
+
$abstract$
+
</div>
+
$endif$
+
</header>
+
$endif$
+
$if(toc)$
+
<nav id="$idprefix$TOC" role="doc-toc">
+
$if(toc-title)$
+
<h2 id="$idprefix$toc-title">$toc-title$</h2>
+
$endif$
+
$table-of-contents$
+
</nav>
+
$endif$
+
<article>
+
$body$
+
$for(include-after)$
+
$include-after$
+
$endfor$
+
</article>
+
</body>
+
</html>
+74
resizecropspring.sh
···
+
#!/bin/bash
+
#
+
# quick script to make variants for animated retrospring icons or headers and direct upload to replace a user's existing ones. good for when a user wants to use a specific gif but carrierwave processing glitches it somehow
+
#
+
# deps: charmbracelet/gum, imagemagick
+
+
filename=$(gum input --placeholder "without an extension")
+
+
echo -e "header or icon \n"
+
+
CHOOSE=$(gum choose --limit 1 "header" "icon")
+
+
echo -e "you chose ${CHOOSE} \n"
+
+
echo -e "making dirs \n"
+
+
if [ "${CHOOSE}" == "header" ]; then
+
mkdir web mobile retina original
+
elif [ "${CHOOSE}" == "icon" ]; then
+
mkdir large medium small original
+
else
+
echo -e "mkdir failed for some reason"
+
fi
+
+
echo -e "dirs made \n"
+
+
echo -e "copying original from workdir to dedicated folder \n"
+
+
cp ./$filename.gif ./original/$filename.gif
+
+
echo -e "move done \n"
+
+
ORIGW=$(identify -format '%w' ./original/$filename.gif[0])
+
ORIGH=$(identify -format '%h' ./original/$filename.gif[0])
+
+
echo -e "making mobile version \n"
+
+
if [ "${CHOOSE}" == "header" ]; then
+
magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 450x105^ /tmp/tmp-header-mobile.gif && magick /tmp/tmp-header-mobile.gif -gravity center -crop 450x105+0+0 +repage ./mobile/$filename.gif
+
+
echo -e "mobile done \n"
+
+
echo -e "making retina version \n"
+
+
magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 900x210^ /tmp/tmp-header-retina.gif && magick /tmp/tmp-header-retina.gif -gravity center -crop 900x210+0+0 +repage ./retina/$filename.gif
+
+
echo -e "retina done \n"
+
+
echo -e "making web version \n"
+
+
magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 1500x350^ /tmp/tmp-header-web.gif && magick /tmp/tmp-header-web.gif -gravity center -crop 1500x350+0+0 +repage ./web/$filename.gif
+
+
echo -e "web done \n"
+
elif [ "${CHOOSE}" == "icon" ]; then
+
magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 80x80^ /tmp/tmp-icon-small.gif && magick /tmp/tmp-icon-small.gif -gravity center -crop 80x80+0+0 +repage ./small/$filename.gif
+
+
echo -e "small done \n"
+
+
echo -e "making medium version \n"
+
+
magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 256x256^ /tmp/tmp-icon-medium.gif && magick /tmp/tmp-icon-medium.gif -gravity center -crop 256x256+0+0 +repage ./medium/$filename.gif
+
+
echo -e "medium done \n"
+
+
echo -e "making large version \n"
+
+
magick -size $ORIGWx$ORIGH^ ./original/$filename.gif -coalesce -resize 500x500^ /tmp/tmp-icon-large.gif && magick /tmp/tmp-icon-large.gif -gravity center -crop 500x500+0+0 +repage ./large/$filename.gif
+
+
echo -e "large done \n"
+
else
+
echo -e "img creation failed for some reason idk"
+
fi
+
+
echo -e "script done"