Skip to content

Instantly share code, notes, and snippets.

View Nezteb's full-sized avatar
💣
hello world'); DROP TABLE Statuses;--

Noah Betzen Nezteb

💣
hello world'); DROP TABLE Statuses;--
View GitHub Profile
# 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 April 1, 2023 21:00
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"])
@Nezteb
Nezteb / kubeforward.sh
Last active March 29, 2023 04:24
A simple shell wrapper around socat for tunneling a TCP port in a Kubernetes cluster.
kubeforward() {
# https://yuku.takahashi.coffee/blog/2020/07/connect-to-a-resource-behind-a-k9s-cluster-from-local-machine
# https://hub.docker.com/r/alpine/socat
if [[ ($# -ne 3 && $# -ne 4) ]]; then
echo "Usage: kubeforward <endpoint> <endpoint_port> <local_port> [<label>]"
return
fi
KUBE_NAMESPACE="default"
@Nezteb
Nezteb / installing-rsql.sh
Last active March 29, 2023 15:26
Installing rsql on M2 Mac with macOS Ventura?
rsql() {
# https://docs.aws.amazon.com/redshift/latest/mgmt/rsql-query-tool-getting-started.html
# https://stackoverflow.com/questions/38670295/homebrew-refusing-to-link-openssl
# https://www.deepanseeralan.com/tech/openssl-dev-on-macOS/
BREW_PREFIX=$(brew --BREW_PREFIX openssl@1.1)
RSQL_OPENSSL_PATH="/usr/local/opt/openssl@1.1/lib"
LIB="/usr/local/lib"
export PATH="$BREW_PREFIX/bin:$PATH"
export LDFLAGS="-L$BREW_PREFIX/lib"