Skip to content

Instantly share code, notes, and snippets.

View rrrnld's full-sized avatar

rrrnld

View GitHub Profile
@rrrnld
rrrnld / README.md
Last active August 23, 2024 08:35
Interacting with your Firefox bookmarks and history from the command line

Firefox History and Bookmark Command Line Interface

These scripts use fzf and sqlite to efficiently query your firefox history and bookmarks. This is heavily inspired by a post from the creator of fzf: https://junegunn.kr/2015/04/browsing-chrome-history-with-fzf/. fzf allows you to select multiple items and the results returned will be the URLs.

What Does It Look Like?

asciicast

@rrrnld
rrrnld / build.gradle
Created February 3, 2017 13:40
Android build version with git commit hash
// merge this with your current build.gradle
// generates a version name from currently checked out git commit
def getCommitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
@rrrnld
rrrnld / index.html
Created January 24, 2022 12:12
Mathml Test Suite for mathml2latex
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Mathvariant Test</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.css" integrity="sha384-MlJdn/WNKDGXveldHDdyRP1R4CTHr3FeuDNfhsLPYrq2t0UBkUdK2jyTnXPEK1NQ" crossorigin="anonymous">
<style>
body, html {
padding: 0;
margin: 0;
@rrrnld
rrrnld / airsonic.fish
Last active October 22, 2020 23:36
A simple command-line wrapper for interacting with the airsonic api. 🎧 Needs https://fishshell.com/ and https://httpie.org/.
#!/usr/bin/env fish
# Put this in your .config/fish/functions folder and you'll get an `airsonic`
# command that you can use to interact with the rest api. If you just want to
# play around with it, you can execute it directly.
function _airsonic_usage
echo 'Usage: airsonic [-h|--help] -u $user -p $pass [$url] $endpoint [...$params]'
echo
echo 'Interact with an airsonic server via REST. See http://www.subsonic.org/pages/api.jsp for additional documentation.'
@rrrnld
rrrnld / advanced-histogram.clj
Last active July 6, 2019 07:50
Unfinished Clojure puzzle for the purely functional newsletter
user=> (require '[clojure.string :as str])
nil
user=> (def dictionary (->> (slurp "/home/arne/Downloads/purely functional - wordlist.txt")
#_=> (str/split-lines)))
#'user/dictionary
user=> (defn frequency-histogram [phrase]
#_=> (->> (str/split (str/lower-case phrase) #"\s+")
#_=> (map frequencies)
#_=> (apply merge-with +)))
#'user/frequency-histogram
@rrrnld
rrrnld / Perlin.cs
Created May 20, 2019 09:39 — forked from Flafla2/Perlin.cs
Improved Perlin Noise Implementation in C#
public class Perlin {
public static double OctavePerlin(double x, double y, double z, int octaves, double persistence) {
double total = 0;
double frequency = 1;
double amplitude = 1;
for(int i=0;i<octaves;i++) {
total += perlin(x * frequency, y * frequency, z * frequency) * amplitude;
amplitude *= persistence;
@rrrnld
rrrnld / koel-s3-storage.md
Last active October 27, 2018 00:47
How to use Amazon S3 with koel

How to use Amazon S3 for storing your koel media files

In this short tutorial I will show you a (kind of hacky, but working) option to set up your koel instance so that you can store your media files on S3 as provided by Amazon. I will also share some of the insights and experiences I had with the setup. Be aware that it's not officially supported and it might work differently to from what you expect. I myself have not had the setup running for a very long time yet. Feel free to share your thoughts in the comments below or add to the document.

If you feel like supporting me, maybe use my Digital Ocean referral link when signing up. If you do that, please also support the original authors of the various tools. They did the hard work, I just glued it together.

Basic setup

@rrrnld
rrrnld / README.md
Last active August 23, 2018 09:59
Get a random free port on uberspace

Setup instructions

Use ssh to login to your uberspace account, then:

$ wget -O free-port https://gist.githubusercontent.com/heyarne/9a6325149f765151bbcceb26a835dade/raw/1f07b69e62f0c47423acb5cb912482b7d65940f0/free-port.sh
$ chmod +x free-port
$ mv free-port ~/bin
$ free-port
$ # example output: 64477
@rrrnld
rrrnld / e.fish
Created August 2, 2018 16:09
emacsclient wrapper for fish shell
# This is a port of the emacs zsh script found on
# https://medium.com/@bobbypriambodo/blazingly-fast-spacemacs-with-persistent-server-92260f2118b7
# basically it checks whether we have a running emacs server; if we don't, it starts one
function e
emacsclient -n -e "(if (> (length (frame-list)) 1) 't)" ^ /dev/null | grep --silent t
if test $status -eq 1
# not running, -a '' starts a new server
emacsclient -a '' -nqc $argv > /dev/null ^ /dev/null
else
emacsclient -nq $argv > /dev/null ^ /dev/null
@rrrnld
rrrnld / migrate.fish
Last active May 5, 2018 11:07
Move a folder of local bare git repos over to gitea
# assumes you have httpie installed: https://httpie.org/
set GITEA_URL "your.gitea.server"
set USER "YOUR_USERNAME"
set PASS "YOUR_PASSWORD"
for f in (find . -type d -name '*.git')
set --local name (basename $f | sed 's/\.git//')
pushd $f
http -a $USER:$PASS POST https://$GITEA_URL/api/v1/user/repos name=$name
git remote add origin git@$GITEA_URL:$USER/$name.git