Skip to content

Instantly share code, notes, and snippets.

@71
71 / nx.sh
Created November 28, 2018 17:00
Run a command in a Nix-aware PRoot environment.
#!/bin/bash
# Run the given command in a Nix-aware environment installed in
# '~/opt/nix', assuming PRoot is available in '~/opt/bin/proot-x86_64'.
#
# If no arguments are given, 'zsh' is executed.
#
# Note:
# The full path to 'nix.sh' is given instead of '~/.nix-profile/etc/profile.d/nix.sh',
# because in some cases, the symlink may not be property set up when running the script.
@71
71 / nocc.js
Created March 22, 2019 07:59
Violent Monkey script that removes closed captions from subtitles on Netflix.
// ==UserScript==
// @name No closed captions
// @namespace Violentmonkey Scripts
// @match https://www.netflix.com/watch/*
// @grant none
// ==/UserScript==
let lastContainer = null
function removeClosedCaptions() {
@71
71 / notebook.ipynb
Last active August 23, 2023 17:08
Crawling Melon and analyzing Korean song lyrics for a group assignment.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@71
71 / Eff.go
Created February 7, 2020 23:08
Trying to implement algebraic effects in Go.
// Inspired by https://github.com/ocamllabs/ocaml-effects-tutorial
//
// Goroutines can be implemented using effects, and, as it turns
// out, effects can be implemented using Goroutines.
// It does require an explicit `context.Context` argument, though.
//
// Note: The following code is a quick and dirty experiment. It
// is not efficient, and probably leaks memory.
package main
package main
// For lack of actual generics...
type Input interface{}
type Output interface{}
// CallWithCurrentContinuation returns a function k that can be used to invoke a
// continuation-passing-style function f as if it was a direct-style function.
func CallWithCurrentContinuation(f func(input Input, k func(output Output))) func(input Input) Output {
return func(input Input) Output {
@71
71 / boorkmarklet.md
Last active April 18, 2024 19:39
Lists all participants in a Google Meet meeting.

The following bookmarket shows a popup with the name of the participants separated by newlines.

javascript:-function(maxStrLength = 2000) { try { function findParticipants(current, depth = 0) { if (depth > 7) return; if (typeof current !== "object" || current === null || current === window) return; const descriptors = Object.getOwnPropertyDescriptors(current); for (const prop in descriptors) { if (prop.startsWith('["spaces/')) return Object.values(current); const item = findParticipants(descriptors[prop].value, depth + 1); if (item !== undefined) return item; } } const rootState = Object.entries(window).find(x => x[0].startsWith("closure_lm_"))[1], participants = findParticipants(rootState), names = []; function findName(obj) { for (const prop in obj) { const value = obj[prop]; if (typeof value === "object" && value !== null && typeof value[1] === "string") return value[1]; } } for (let i = 0; i < participants.length; i++) { const name = findName(participants[i]); if (names.indexOf(name) === -1) names.
@71
71 / AUTOMATIC_LINKS.md
Last active June 16, 2020 12:59
Google Sheets: automatically link some specific patterns.
module Main
open FSharp.Data
open FSharp.Data.JsonExtensions
open Google.Cloud.Functions.Framework
open System
open System.Globalization
open System.Net
open System.Text.RegularExpressions
@71
71 / Code.gs
Created May 5, 2022 00:53
Generate a "Tags" folder in Google Drive with tags from all files.
function main() {
buildTagsDirectory(
DriveApp.getRootFolder(),
DriveApp.getFolderById("..."),
);
}
/**
* Builds a recursive tags structure in `tagsFolder` with all tags found in items in `rootFolder`.
*/
@71
71 / OpenInSplitScreen.kt
Created November 27, 2022 15:43
Snippet to show a text box that, when long-pressed, allows Chrome to be dropped into a split-screen.
// Inspired by Launcher3:
// https://cs.android.com/android/platform/superproject/+/35157974d49e70f03687edb9408e5897d04ff845:packages/apps/Launcher3/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java;l=293
// Jetpack Compose view with interoperability:
// https://developer.android.com/jetpack/compose/interop/interop-apis
AndroidView(factory = { context ->
TextView(context).apply {
text = "Drag me!"
// Drag and drop listener; see: