Skip to content

Instantly share code, notes, and snippets.

View Nezteb's full-sized avatar

Noah Nezteb

View GitHub Profile
@Nezteb
Nezteb / Dockerfile
Created June 7, 2023 01:01
Deploying Conduit (Matrix homeserver built in Rust) on Fly.io
# https://gitlab.com/famedly/conduit/-/blob/next/docker/README.md
# https://gitlab.com/famedly/conduit/-/blob/next/Dockerfile
# https://hub.docker.com/r/matrixconduit/matrix-conduit
FROM matrixconduit/matrix-conduit:next-bullseye
ENV CONDUIT_SERVER_NAME="my.domain.com"
ENV CONDUIT_DATABASE_BACKEND="rocksdb"
# Set to false after making your first admin user
@Nezteb
Nezteb / atuin.zsh
Created May 5, 2023 00:57
A shell hack for restoring basic up/down arrow functionality with atuin while still using its database instead of vanilla shell history until it's implemented natively: https://github.com/ellie/atuin/issues/798
export ATUIN_ARROW_INDEX=-1
upArrow() {
export ATUIN_ARROW_INDEX=$(( ATUIN_ARROW_INDEX + 1))
COMMAND=$(atuin search --limit 1 --offset $ATUIN_ARROW_INDEX | cut -f2)
LBUFFER="$COMMAND"
return
}
# Install/run these first:
# sudo xcrun xcodebuild -license accept
# xcode-select --install
# brew install postgresql@15 libxml2 openssl@1.1 qt
git clone git@github.com:pgmodeler/pgmodeler.git
cd pgmodeler
git clone git@github.com:pgmodeler/plugins.git
# TODO: Figure out error with sampleplugin? (Or maybe this is expected because it's a sample...)
@Nezteb
Nezteb / removeShortsAndLivesFromYouTubeSubscriptions.js
Created April 11, 2023 01:05
[WIP] Remove Shorts and Lives from YouTube Subscriptions
// ==UserScript==
// @name Remove Shorts and Lives from YouTube Subscriptions
// @description Remove Shorts and Lives from YouTube Subscriptions
// @namespace http://tampermonkey.net/
// @version 0.1
// @author Noah Betzen
// @match https://www.youtube.com/feed/subscriptions
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
@Nezteb
Nezteb / code_settings.sh
Last active October 27, 2023 04:31
Get and maybe update a VS Code setting
# Usage: codeSettings <key> [<value>]
codeSettings() {
SETTINGS_DIR="$HOME/Library/Application Support/Code/User"
FILE="$SETTINGS_DIR/settings.json"
KEY=$1
VALUE=$2
if ! command -v jq &> /dev/null; then
echo -e "ERROR\n\tjq must be installed to process JSON"

openpgp4fpr:BA4DA9CABC611D90D3F4822421F78F35EB0750DC

@Nezteb
Nezteb / frexp_min.ex
Created April 5, 2023 17:26
By ChatGPT using GPT-4
# "please implement the frexp function in elixir, and minify it as much as possible"
defmodule Decode do
use Bitwise
@b 1022
def frexp(v), do: <<s::1, e::11, f::52>> = <<v::float>>; frexp(s, f, e)
defp frexp(_, 0, 0), do: {0.0, 0}
defp frexp(s, f, 0), do: exp = bl(f); <<r::float>> = <<s::1, @b::11, (f-1)::52>>; {r, -(@b) - 52 + exp}
defp frexp(s, f, e), do: <<r::float>> = <<s::1, @b::11, f::52>>; {r, e - @b}
def bl(v), do: bl(v, 0)
defp bl(0, n), do: n
{"created_by":"Tampermonkey","version":"1","scripts":[{"name":"Remove resolved bot threads on a merge request","options":{"check_for_updates":false,"comment":null,"compat_foreach":false,"compat_metadata":false,"compat_powerful_this":null,"compat_wrappedjsobject":false,"compatopts_for_requires":true,"noframes":null,"override":{"merge_connects":true,"merge_excludes":true,"merge_includes":true,"merge_matches":true,"orig_connects":[],"orig_excludes":[],"orig_includes":[],"orig_matches":["https://gitlab.com/incharging*merge_requests/*"],"orig_noframes":null,"orig_run_at":"document-idle","use_blockers":[],"use_connects":[],"use_excludes":[],"use_includes":[],"use_matches":[]},"run_at":null,"sandbox":null,"tab_types":null,"unwrap":null},"storage":{"ts":1677781763827,"data":{}},"enabled":true,"position":1,"uuid":"9d53d50d-1cce-493d-bd37-aac54a40d408","source":"Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgICBSZW1vdmUgcmVzb2x2ZWQgYm90IHRocmVhZHMgb24gYSBtZXJnZSByZXF1ZXN0Ci8vIEBkZXNjcmlwdGlvbiAgUmVtb3ZlIHJlc29sdmVkIGJvdCB
@Nezteb
Nezteb / removeHackerNewsThreadsByRegex.js
Last active December 27, 2025 05:35
Remove HackerNews threads by regex (for use with https://www.tampermonkey.net/)
// ==UserScript==
// @name Remove HackerNews threads by regex
// @description Remove HackerNews threads by regex
// @namespace http://tampermonkey.net/
// @version 0.1
// @author Noah Betzen
// @match https://news.ycombinator.com/
// @match https://news.ycombinator.com/news
// @icon https://www.google.com/s2/favicons?sz=64&domain=ycombinator.com
// @grant none
@Nezteb
Nezteb / check_types.ex
Created March 29, 2023 01:02
Theoretical mix task that will fail/alert when new Dialyzer errors are added to codebase. Based on: https://www.youtube.com/watch?v=4PZE40h13wM
defmodule Mix.Tasks.CheckTypes do
@moduledoc "The checktypes mix task: `mix help checktypes`"
use Mix.Task
@shortdoc "Runs Dialyzer and compares the results to our existing errors."
def run(_args) do
# https://github.com/jeremyjh/dialyxir/blob/ed0df656a74eb6d4e906fe20fc056ca42ba7d5ec/lib/mix/tasks/dialyzer.ex#L145-L155
output = Mix.Task.run("dialyzer", ["--quiet", "--format", "ignore_file"])