Skip to content

Instantly share code, notes, and snippets.

View 166MMX's full-sized avatar

Johannes Harth 166MMX

View GitHub Profile
@166MMX
166MMX / path.sh
Last active April 5, 2024 15:16
work in progress intelligent - currently not so much - wip PATH manager
#!/usr/bin/env sh
set -e -u
# https://peterlyons.com/problog/2012/09/managing-per-project-interpreters-and-the-path/
# Function to append a directory to PATH if it exists
add_path() {
if [ -d "$1" ]; then
PATH="$PATH:$1"
fi
@166MMX
166MMX / cmd.origin.sh
Last active January 13, 2024 17:24
macOS Sierra /usr/bin/ Origin
#!/usr/bin/env bash
main() {
header
find "$1" \( -type f -o -type l \) -print0 | while IFS= read -r -d ''; do
second "$REPLY"
done
}
second() {
@166MMX
166MMX / git-merge-associate.py
Last active January 2, 2024 15:43 — forked from tvogel/git-merge-associate
git script to manually associate files in a conflicting merge when rename detection fails
#!/usr/bin/env python
import dataclasses
import locale
import subprocess
import sys
"""
Purpose: Manually associate missed renames in merge conflicts during Git merges.
Usage: git merge-associate <our-target> <base> <theirs>

https://www.ghacks.net/2021/11/26/how-to-turn-off-search-the-web-results-in-windows-11/

\Local Computer Policy\Computer Configuration\Administrative Templates\Windows Components\Search

  • "Allow Cortana" -> Disabled
  • "Allow search and Cortana to use location" -> Disabled
  • "Do not allow web search" -> Enabled
  • "Don't search the web or display web results in Search" -> Enabled

\Local Computer Policy\User Configuration\Administrative Templates\Start Menu and Taskbar

  • "Do not search Internet" -> Enabled
{
"downloads": {
"artifact": {
"path": "net/optifine/optifine/1.19.4_HD_U_I3/optifine-1.19.4_HD_U_I3.jar",
"sha1": "050d787936cc239ea8db0aa250d2ed72a44fa71d",
"size": 6979831,
"url": "https://optifine.net/downloadx?f=OptiFine_1.19.4_HD_U_I3.jar&x=ae83c9b7cc9043a6b704027e3f6bbac2"
}
},
"name": "net.optifine:optifine:1.19.4_HD_U_I3"
@166MMX
166MMX / signaling-server.ts
Created March 21, 2023 10:14 — forked from ronnyroeller/signaling-server.ts
Lambda function to provide webrtc signaling server
import { ApiGatewayManagementApi, DynamoDB } from 'aws-sdk';
import { scanItems } from './dynamodb';
const { AWS_REGION, TOPICS_TABLE } = process.env;
const dynamoDb = new DynamoDB({
apiVersion: '2012-08-10',
region: AWS_REGION,
});
@166MMX
166MMX / install_dnsmasq.sh
Created September 22, 2022 05:56
dnsmasq with NetworkManage and systemd-resolved Ubuntu 22.04
#!/usr/bin/env sh
# Install and use dnsmasq with NetworkManage support
# along side with systemd-resolved by disableing DNS stub listener
# on Ubuntu 22.04.1 LTS (Jammy Jellyfish)
# https://superuser.com/questions/681993/using-dnsmasq-with-networkmanager
# https://askubuntu.com/questions/1393486/dnsmasq-and-networkmanager-dns
# https://unix.stackexchange.com/questions/304050/how-to-avoid-conflicts-between-dnsmasq-and-systemd-resolved
# https://askubuntu.com/questions/1032450/how-to-add-dnsmasq-and-keep-systemd-resolved-18-04-to-20-04
# man -- NetworkManager.conf | sed '/^$/d' | sed -n '$p' | sed -E 's/ {3,39}/;/g' | cut '-d;' -f1
@166MMX
166MMX / main.sh
Created July 9, 2020 21:17
rfc-ref
#!/bn/sh
# https://www.rfc-editor.org/rfc/rfc-ref.txt
perl -n -e 'local $\ = "\n",$,=";";/^(RFC[0-9]+) \|\s+((((, )?(RFC|RTR)[0-9]+)+)|(NIC [0-9]+))?\s+\| (.*), "(.*)"(, (RTR [0-9]+))?(, (FYI [0-9]+))?(, (BCP [0-9]+))?(, (STD [0-9]+))?(, (RFC [0-9]+))?(, (DOI [0-9]+\.[0-9]+\/RFC[0-9]+))?, ((January|February|March|April|May|June|July|August|September|October|November|December)( [0-9]{1,2})? [0-9]{4}), <(https?:\/\/.*)>\./; print $1,$2,$8,$9,$11,$13,$15,$17,$19,$21,$23,$25' rfc-ref.txt >rfc-ref.csv
@166MMX
166MMX / restore_freeze_new_relic_wrapped_fns.js
Created August 13, 2021 16:05
greasemonkey new relic unwrapper
(function (window) {
const m = new Map(Object.entries({
'window': new Map(Object.entries({
'clearTimeout': new Map(Object.entries({
'NREUM.o': 'CT',
})),
'setInterval': null,
'requestAnimationFrame': null,
'webkitRequestAnimationFrame': null,
'Event': new Map(Object.entries({
(function () {
const b = new Set(['previousElementSibling','offsetParent','parentNode','parentElement','nextElementSibling','nextSibling','previousSibling','documentElement','body','ownerDocument','firstElement',
'head','images','scripts','links','forms','scrollingElement','children','firstElementChild','lastElementChild','activeElement','ownerNode','childNodes','styleSheets','lastChild'
]);
const v = new Set();
const a = function (s, n) {
if (v.has(s)) {
return;
}
v.add(s);