Skip to content

Instantly share code, notes, and snippets.

@yorickvP
yorickvP / README.md
Last active November 3, 2024 13:49
HN Keyboard Navigation

HN Keyboard Navigation

A userscript that adds keyboard navigation to Hacker News comment threads.

Features

  • Navigate between comments using keyboard shortcuts
  • Highlight currently selected comment
  • Collapse/expand comment threads
  • Jump between comments at the same level
import xml.etree.ElementTree as ET
from datetime import datetime, timedelta
import uuid
from slugify import slugify
import re
MY_NAMESPACE = uuid.UUID('ca6c8e77-59a4-4e51-919c-25e38457f0ee')
def generate_deterministic_uuid(*args):
# Convert all arguments to strings and join them
name = ':'.join(map(str, args))
declare module 'datascript' {
type Db = string & {_opaque: typeof Db};
const Db: unique symbol;
type Conn = string & {_opaque: typeof Conn};
const Conn: unique symbol;
interface Iterable<T> {
next(): { value: null, done: true } | { value: T, done: false }
DeepEvaluated = int | float | str | "String" | None | dict[string, "Evaluated"] | list["Evaluated"] | Function
Evaluated = int | float | "String" | None | dict[string, "Value"] | list["Value"] | "Function"
T = TypeVar('T', bound=Evaluated)
class Value:
def __init__(self, x: Value | Evaluated | DeepEvaluated):
"""
Make a new Value from python
"""
# nix-build -E '((import <nixpkgs> {}).callPackage ./nix/onivim2.nix {})'
{ stdenv, lib, appimageTools, requireFile, autoPatchelfHook, makeWrapper, pango, cairo, gobject-introspection, glib, epoxy, libgpgerror, gdk-pixbuf, libxkbcommon, gtk3, ncurses5, acl, xorg, libGLU }:
stdenv.mkDerivation {
name = "Oni2";
version = "0.5.9-nightly";
dontStrip = true;
buildInputs = [
autoPatchelfHook
pango
cairo
with import <nixpkgs/lib>;
let
inherit (builtins) typeOf;
cfg = import ./router-config.nix;
indent = str:
let
parts = (splitString "\n" str);
plen = length parts;
in concatStringsSep "\n"
(imap0 (i: v: if (i == 0 || i == plen - 1) then v else " ${v}") parts);
{ stdenv, lib, fetchurl, appimageTools, electron_8, makeWrapper }:
stdenv.mkDerivation rec {
pname = "MQTT-Explorer";
version = "0.4.0-beta1";
src = appimageTools.extract {
name = pname;
src = fetchurl {
url = "https://github.com/thomasnordquist/${pname}/releases/download/0.0.0-${version}/${pname}-${version}.AppImage";
sha256 = "0x9ava13hn1nkk2kllh5ldi4b3hgmgwahk08sq48yljilgda4ppn";
{ stdenv, fetchFromGitHub, cmake, pkgconfig }:
let
inherit (stdenv.lib) optionals;
isCross = stdenv.buildPlatform != stdenv.hostPlatform;
in
stdenv.mkDerivation {
pname = "raspberrypi-armstubs";
version = "2020-10-08";
// code is MIT licensed etc etc copyright 2018 @puckipedia
// - dsmrv5 parser / @yorickvp
// -- Libraries used --
#pragma GCC diagnostic warning "-Wall"
#pragma GCC diagnostic warning "-Wextra"
// ESP8266 OTA
#include <ArduinoOTA.h>
// look I'm not going to pay for a signal inverter. hooray for software
#define INVERT_SERIAL
{ stdenvNoCC, fetchFromGitHub, telink-825x-sdk, tc32-gcc, python3 }:
stdenvNoCC.mkDerivation {
pname = "ATC_Thermometer";
version = "20201003";
src = "${fetchFromGitHub {
owner = "atc1441";
repo = "ATC_MiThermometer";
rev = "772348a2266ea22bd58795314be148a8154e6462";
sha256 = "05ggw0c61fbhw751c5icpv31i0cjk2nx5nmnkixid07ajsmhb7fw";
}}/ATC_Thermometer";