Skip to content

Instantly share code, notes, and snippets.

View 166MMX's full-sized avatar

Johannes Harth 166MMX

View GitHub Profile
@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>
@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 / 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 / README.md
Created February 19, 2020 14:41 — forked from brandt/README.md
Creates a loopback alias with IP 127.0.0.2 at startup on Mac OS X

Loopback Alias

Creates an alias on the loopback interface (lo0) with the IP 127.0.0.2 on macOS.

Installation

  1. Install the plist to: /Library/LaunchDaemons/com.runlevel1.lo0.127.0.0.2.plist
  2. Set mode: sudo chmod 0644 /Library/LaunchDaemons/com.runlevel1.lo0.127.0.0.2.plist
  3. Set owner: sudo chown root:wheel /Library/LaunchDaemons/com.runlevel1.lo0.127.0.0.2.plist
  4. Load: sudo launchctl load /Library/LaunchDaemons/com.runlevel1.lo0.127.0.0.2.plist
@166MMX
166MMX / parse_pbzx2.py
Created October 2, 2016 21:34 — forked from Manouchehri/parse_pbzx2.py
A pbzx stream decoder for the format found within Yosemite package payloads.
# v2 pbzx stream handler
# My personal writeup on the differences here: https://gist.github.com/pudquick/29fcfe09c326a9b96cf5
#
# Pure python reimplementation of .cpio.xz content extraction from pbzx file payload originally here:
# http://www.tonymacx86.com/general-help/135458-pbzx-stream-parser.html
#
# Cleaned up C version (as the basis for my code) here, thanks to Pepijn Bruienne / @bruienne
# https://gist.github.com/bruienne/029494bbcfb358098b41
import struct, sys
#!/usr/bin/env python
import sys
import datetime
frankierart={
0x01:'Stampit 2003',
0x02:'0x02???',
0x03:'Frankit',
0x05:'Filiale',
0x07:'Frankierservice Infopost/Infobrief',
0x08:'Premiumadress',
#!/usr/bin/python
#
# git-slim
#
# Remove big files from git repo history.
#
# Requires GitPython (https://github.com/gitpython-developers/GitPython)
#
# References:
# - http://help.github.com/remove-sensitive-data/

Creating a TimerTask can not get easier than this thanks to groovy.

  • import java.util.timer.* is not required as java.util is already imported.
  • the run() is implemented as closure

To Run this:

groovy https://gist.github.com/kdabir/3176945/raw/timer_example.groovy

@166MMX
166MMX / crossGrease.user.js
Last active October 11, 2015 10:27 — forked from sanemat/script.js
Script to load required external scripts before execution of user code - Cross browser compatible
// ==UserScript==
// @name CrossGrease
// @namespace https://gist.github.com/166MMX/
// @description Script to load required external scripts before execution of user code - Cross browser compatible
// @downloadURL https://gist.github.com/166MMX/3845101/raw
// @updateURL https://gist.github.com/166MMX/3845101/raw
// @version 1.3
// ==/UserScript==
var crossGrease = function () {