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 / 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 / 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);
@166MMX
166MMX / c-struct-to-ksy.rb
Last active May 15, 2021 22:34 — forked from GreyCat/c-struct-to-ksy.rb
Convert C struct into Kaitai Struct spec (.ksy)
#!/usr/bin/env ruby
require 'yaml'
TYPE_TO_KSY = {
'uint8_t' => 'u1',
'uint16_t' => 'u2',
'uint32_t' => 'u4',
'uint64_t' => 'u8',
@166MMX
166MMX / pydevd.py
Last active October 3, 2020 08:55
PyCharm fix module name clash during debugger startup
from contextlib import contextmanager
@contextmanager
def bootstrap():
from os import environ
from sys import path as sys_path
roots = environ['IDE_PROJECT_ROOTS'].split(':')
pwd = environ['PWD']
try: