Skip to content

Instantly share code, notes, and snippets.

View tobek's full-sized avatar

Toby Fox tobek

View GitHub Profile
tobek /
Last active April 3, 2024 15:55
Roam bookmarklet for rich link embeds, read later, and bookmark management


  1. Create a browser bookmark (e.g. in bookmarks bar) where the URL is the text in bookmarklet below (open this "raw" link so it's not truncated). Yes it's huge, that's fine. You can name the bookmark "Roam Link" or whatever you like.
    • Alternately, go to this page for easier drag-and-drop bookmarklet setup (GitHub doesn't allow javascript links in gists, sorry)
  2. Go to or create a Roam page called roam/css, and create a CSS code block (``` for code block, then change the language selector dropdown to CSS) and paste the CSS below.


  1. On the page you want to create a link embed of, hit the bookmarklet (optional: highlight some text first and it'll be included as a quote)
  2. Go to Roam and paste
tobek /
Created October 19, 2020 23:16
Rip and encode individual titles and chapters from DVD or ISO
set -eo pipefail
shopt -s expand_aliases
alias ffmpeg='ffmpeg -hide_banner'
cat << EOF
tobek /
Last active June 21, 2023 22:58
Script for keeping your windows and applications handy
cat << EOF
This script will search the X window manager for any open window containing SEARCH_STRING and, if found, will move to the containing desktop, raise that window, and give it focus.
If a matching window on the current desktop is found, that will be focused first instead of any matching windows on other desktops.
tobek / lastfm-remove-duplicates.js
Last active March 7, 2018 17:20 — forked from sk22/lastfm-remove-duplicates.js duplicate scrobble deleter
var dupesFound = 0;
var elements = Array.from(document.querySelectorAll('.js-link-block')) (element) {
var nameElement = element.querySelector('.chartlist-name')
return nameElement && nameElement.textContent.replace(/\s+/g, ' ').trim()
}).forEach(function (name, i, names) {
if (name !== names[i + 1]) return
var deleteButton = elements[i].querySelector('[data-ajax-form-sets-state="deleted"]')
if (deleteButton) {
tobek / habitica-tags-userscript.js
Created January 26, 2017 00:06
Habitica Tag Visibility Userscript
// ==UserScript==
// @name Habitica Tag Visibility
// @namespace tobek-habitica
// @version 0.1
// @description Makes tags visible in the name of the task, without having to hover over the tags icon. Tags are shown as "[tag1][tag2][...] Task name...". This is a total hack and would be much better as part of official Habitica codebase but that's more work and discussion than the 10m I spent on this.
// @author Tobek
// @match*
// @grant none
// ==/UserScript==
tobek /
Created December 9, 2016 01:47
Linux daemon for alerting you if you're running out of memory
# Minimum available memory limit, MB
# Check time interval, sec
while :
tobek / tgp.conf
Created December 3, 2016 04:25
PHP-FPM config for TGP on Linux
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
tobek / vice-mag-headline-generator.js
Created July 15, 2016 20:30
@deadlydizzle's Vice Magazine Headline Generator script
/* Vice Magazine Headline Generator script
Author: David Alexander ( / @deadlydizzle)
Version: 1.0 September 1, 2014
License: GNU General Public License, version 3.0 (GPLv3)
// Tell JSLint's 'defined but never used' error to take a hike
/* exported setHeadline */
tobek / youtube-upload.html
Created March 25, 2016 02:39
YouTube API v3 upload video and set snippet etc.
<!-- More info at -->
<form id="upload-yt-video" action="" method="post" enctype="multipart/form-data">
<input type="text" name="title" placeholder="Video title">
<textarea name="description" placeholder="Video description"></textarea>
<input type="file" accept="video/*" name="videoFile">
<input type="submit" value="Upload Video">
<!-- load jQuery -->
tobek / grunt-aws-s3.js
Created January 10, 2016 22:23
basic config for grunt-aws-s3 task
// using
aws_s3: {
options: {
accessKeyId: '<%= aws.key %>',
secretAccessKey: '<%= aws.secret %>',
// putting no region makes it default to US Standard
// debug: true, // do a dry run
uploadConcurrency: 5