Skip to content

Instantly share code, notes, and snippets.

@joshkunz
joshkunz / test.patch
Created December 30, 2023 00:07
Test patch for improving build on OpenBSD
diff --git a/meson.build b/meson.build
index 26513a8..c4864d8 100644
--- a/meson.build
+++ b/meson.build
@@ -172,7 +172,7 @@ libashuffle = static_library(
'ashuffle',
sources,
include_directories: src_inc,
- dependencies: absl_deps + [yaml_cpp],
+ dependencies: absl_deps + [yaml_cpp, libmpdclient],
@joshkunz
joshkunz / tmuxs.fish
Created June 16, 2021 00:11
A Fish shortcut + autocomplete for tmux sessions.
# Copyright 2021 Google LLC.
# SPDX-License-Identifier: Apache-2.0
# Connect to or create the given tmux session.
function tmuxs --argument session
tmux attach -t $session; or tmux new-session -s $session
end
# List the active tmux sessions in a format that is usable by autocomplete.
function _tmux_active_sessions
@joshkunz
joshkunz / go-to-home-shortcut.tid
Created May 25, 2021 04:34
TiddlyWiki shortcut to go to the homescreen. I bind it to `.`.
created: 20210329185533140
key: ((jkz-go-home))
modified: 20210329190014761
revision: 0
tags: $:/tags/KeyboardShortcut
title: P:/shortcut/jkz-Go-Home
type: text/vnd.tiddlywiki
Shortcut to go to the home view.
@joshkunz
joshkunz / meetings.json
Created May 25, 2021 04:32
TiddlyWiki macros for managing recurring meetings.
[
{
"created": "20210315203900336",
"text": "\\define meetings-last-entries(ndays:30)\n\n<!-- Transclude all meeting-entry tiddlers that start with this prefix. Format them as entries. -->\n{{{ [tag[meeting-entry]prefix<currentTiddler>days[-$ndays$]!sort[created]] ||P:/template/MeetingEntry }}}\n\n\\end\n\n```\nCopyright 2021 Google LLC.\nSPDX-License-Identifier: Apache-2.0\n```\n\nUse `<<meetings-last-entries>>` to transclude the notes from recent meetings into the tiddler. The optional `ndays` arguments sets the number of days of history of meetings to include (note: NOT the number of meetings).",
"bag": "default",
"revision": "0",
"type": "text/vnd.tiddlywiki",
"title": "P:/macro/meetings/LastEntries",
"tags": "P:/macro/meetings",
"modified": "20210525042546451"
@joshkunz
joshkunz / repro.log
Last active February 3, 2020 23:24
Repro instructions for QEMU SIGRTMIN patch
$ go version
go version go1.13.7 linux/amd64
$ env GOOS=linux GOARCH=arm64 go build test.go
$ aarch64-linux-user/qemu-aarch64 ./test
fatal error: sigaction failed
runtime stack:
runtime.throw(0xd60c0, 0x10)
~/code/go/src/runtime/panic.go:774 +0x54
runtime.sysSigaction.func1()
#!/bin/bash
cd /sys/kernel/config/usb_gadget/
mkdir -p pi4
cd pi4
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
@joshkunz
joshkunz / keybase.md
Created June 18, 2019 05:06
Keybase proof for keybase.io/joshkunz

Keybase proof

I hereby claim:

  • I am joshkunz on github.
  • I am joshkunz (https://keybase.io/joshkunz) on keybase.
  • I have a public key ASAFydC3Pw9tk4JPBdLBDlzVDiZ-l5_hFsBD2xOaGI-cxAo
@joshkunz
joshkunz / main.rs
Created November 16, 2018 07:55
Example homebrew flag parser in rust.
use std::collections::HashMap;
use std::convert::From;
use std::env;
use std::error;
use std::boxed::Box;
use std::iter::FromIterator;
type Error = Box<error::Error>;
fn parse_arg(s: &str) -> Result<(&str, &str), Error> {
@joshkunz
joshkunz / mpd_fileaccess-v0.20.5.patch
Created February 22, 2017 22:18
This patch allows you to play any file on your local filesystem (that the MPD server can read) using the `file://` URI syntax.
diff --git a/src/client/ClientFile.cxx b/src/client/ClientFile.cxx
index 0382789..9c41d2c 100644
--- a/src/client/ClientFile.cxx
+++ b/src/client/ClientFile.cxx
@@ -33,19 +33,17 @@ Client::AllowFile(Path path_fs) const
throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
#else
- if (uid >= 0 && (uid_t)uid == geteuid())
- /* always allow access if user runs his own MPD
@joshkunz
joshkunz / scrape.js
Last active November 15, 2015 23:55
Script to scrape netflix ranking history found at https://www.netflix.com/MoviesYouveSeen . Sorry about the formatting, I just typed it in the dev-tools box. Outputs as csv in the form "Netflix movie id,date,title,rating". Ratings are 1-5, -3 means "not interested".
var elems = document.querySelectorAll("li.retableRow"); for (i = 0; i < elems.length; i++) { var item = elems[i]; var mid = item.getAttribute("data-movieid"); var date = item.querySelector(".col.date").textContent; var title = item.querySelector(".col.title a").textContent; var rating = item.querySelector(".col.rating div").getAttribute("data-your-rating"); console.log(mid + "," + date + "," + "\"" + title + "\"" + "," + rating); }