Skip to content

Instantly share code, notes, and snippets.

@solarkennedy
solarkennedy / fetch-somafm.sh
Created January 27, 2022 22:50
Curl + JQ of SomaFM Stations
curl -s "https://somafm.com/channels.json" | jq -r '.channels[] | "\(.title): \(.playlists[0].url)"'
@solarkennedy
solarkennedy / README.md
Created July 11, 2020 21:48
Post image to Desmos Drawing

Desmos allows you to draw images.

But it accepts arbitrary points as json. You can upload "images"!

  1. Get an image, reduce the size to say 100 x 100 pixels. Full color rgb (even alpha) is fine. Call it input.jpg
  2. Copy-as-curl after editing a desmos graph from your browser.
  3. Run the python script to get a desmos-compatible json blob: python3 desmos.py > out.json
  4. Run the curl with the output json file, but instead of curling with --data ... use --data @out.json on your terminal
  5. Refresh your browser!
@solarkennedy
solarkennedy / archive_kodi_videos_to_git_annex.sh
Created May 17, 2020 16:57
Script to move watched videos in Kodi to a git annex remote
#!/bin/bash
SQL=$(cat <<EOF
select p.strPath || f.strFilename
from files f
join path p
on p.idPath = f.idPath
where f.playCount > 0;
EOF
)
@solarkennedy
solarkennedy / termux
Created July 25, 2019 23:46
bootstrap
termux-setup-storage
pkg install wget dropbear golang python3 units curl nmap vim
go get -u github.com/justjanne/powerline-go
echo '
function _update_ps1() {
PS1="$(~/go/bin/powerline-go -condensed -error $?)"
}
@solarkennedy
solarkennedy / _Math Jam Puzzle or Riddler Express from Tyler Barron.
Last active May 17, 2020 16:53
Math Jam Puzzle / Riddler Express from Tyler Barron
You are given an empty 4-by-4 square and one marker. You can color in the individual squares or leave them untouched. After you color as many or as few squares as you’d like, I will secretly cut out a 2-by-2 piece of it and then show it to you without rotating it. You then have to tell me where it was (e.g., “top middle” or “bottom right,” etc.) in the original 4-by-4 square.
Can you design a square for which you’ll always know where the piece came from?
https://fivethirtyeight.com/features/can-you-construct-the-optimal-tournament/
@solarkennedy
solarkennedy / input.yaml
Created May 26, 2019 04:50
All Yaml Booleans
---
- false
- False
- FALSE
- n
- N
- no
- No
- NO
- off
@solarkennedy
solarkennedy / project_to_cone.py
Last active May 17, 2020 16:55
project stuff onto a cone using tensorflow from krall
#!/usr/bin/env python3
import numpy as np
import tensorflow as tf
import scipy.misc
import scipy.ndimage
from tensorflow import sin, cos, sqrt, atan2
from math import pi
top_circ = 265.
@solarkennedy
solarkennedy / kwas python quine
Last active April 3, 2018 11:17
silly python quine
A quine is program that prints itself
@solarkennedy
solarkennedy / analyze.sh
Created February 25, 2018 19:39
List of mesos frameworks in the DC/OS Universe
#!/bin/bash
[[ -d universe ]] || git clone git@github.com:mesosphere/universe.git
for package_folder in universe/repo/packages/*/*; do
pushd "${package_folder}" 1>/dev/null
latest=$(ls -1 | sort -rn | head -n 1)
if [[ "$(jq -r .framework $latest/package.json)" == "true" ]]; then
jq -r .name "$latest/package.json"
fi
popd 1>/dev/null
@solarkennedy
solarkennedy / troll-yaml output
Last active May 26, 2019 04:41
A demonstration of some surprising yaml junk
$ uq troll-yaml.yaml
{
"country list": [
"US",
"GB",
false
],
"end_date": 20130510,
"favorite_prog_rock_band": true,
"homedir_location": null,