Skip to content

Instantly share code, notes, and snippets.

View kfix's full-sized avatar
🚲
spinning wheels

Joey Korkames kfix

🚲
spinning wheels
View GitHub Profile
@NiceRath
NiceRath / nftables_tproxy_example.nft
Last active March 6, 2025 12:00
NFTables TPROXY - proxy input and output
#!/usr/sbin/nft -f
# see also:
# https://wiki.nftables.org/wiki-nftables/index.php/Netfilter_hooks
# https://docs.kernel.org/networking/tproxy.html
# https://powerdns.org/tproxydoc/tproxy.md.html
# http://git.netfilter.org/nftables/commit/?id=2be1d52644cf77bb2634fb504a265da480c5e901
# http://wiki.squid-cache.org/Features/Tproxy4
# https://serverfault.com/questions/1052717/how-to-translate-ip-route-add-local-0-0-0-0-0-dev-lo-table-100-to-systemd-netw
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/net/netfilter/nft_tproxy.c
@MrBlank
MrBlank / MiSTer_Dell_2007FPB.ini
Last active April 14, 2025 23:50
MiSTer ini settings for Dell Ultrasharp 2007FPB
[MiSTer]
; 1600x1200 Settings for Dell Ultrasharp 2007FP (May work with other 1600x1200 resolution monitors)
; ---------------------------------------------
video_mode=1600,64,192,304,1200,1,3,46,162000
; DVI mode through HDMI (best quality)
; ---------------------------------------------
dvi_mode=1 ; set to 1 for DVI mode. Audio won't be transmitted through HDMI in DVI mode.
@nicowilliams
nicowilliams / fork-is-evil-vfork-is-good-afork-would-be-better.md
Last active March 14, 2025 02:50
fork() is evil; vfork() is goodness; afork() would be better; clone() is stupid

I recently happened upon a very interesting implementation of popen() (different API, same idea) called popen-noshell using clone(2), and so I opened an issue requesting use of vfork(2) or posix_spawn() for portability. It turns out that on Linux there's an important advantage to using clone(2). I think I should capture the things I wrote there in a better place. A gist, a blog, whatever.

This is not a paper. I assume reader familiarity with fork() in particular and Unix in general, though, of course, I link to relevant wiki pages, so if the unfamiliar reader is willing to go down the rabbit hole, they should be able to come ou

@leonbreedt
leonbreedt / CustomPropertyJSValueLifetime.swift
Last active January 21, 2021 17:00
JavaScriptCore custom property JSValue lifetime
import Cocoa
import JavaScriptCore
/// Something that can be represented as a `JSValue`.
protocol JSValueRepresentable {
/// The `JSValue` for this thing.
var jsValue: JSValue { get }
}
@DrewML
DrewML / Theming-Slack-OSX.md
Last active January 25, 2022 00:53
Theming Slack for OSX

Theming Slack for OSX

So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode!

Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.

But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.

How to (OSX Only)

@DrewML
DrewML / slack-slashes.md
Created May 1, 2016 16:36
"Secret" Slack slash commands

"Secret" Slack Slash Commands

Enable Web Inspector

/macgap.app.enabledevelopertools()

Assign a color (using hex code) to any users name

/color andrew #000000

Change Status (Doesn't seem to work)

/status

@ytjohn
ytjohn / GPG-Salt-Prod.md
Created January 29, 2016 15:01
GPG-Salt-Prod.md

GPG In Pillar

Include this file in the git repo with your pillar data. It provides instructions for those commiting code to securely save and commit senstive data (like password and private certs).

This the Salt Prod key:

key A1234567: "Salt Prod [email protected]"

@jtbandes
jtbandes / decode-dyn-uti.swift
Last active March 11, 2025 10:13
Dynamic UTI decoding
/// Decodes a dynamically-generated Uniform Type Identifier for inspection purposes. (**NOT FOR PRODUCTION USE!**)
/// Many, many thanks to http://alastairs-place.net/blog/2012/06/06/utis-are-better-than-you-think-and-heres-why/
///
/// <https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-BCGCDHIJ>
func decodeDynUTI(_ uti: String) -> String?
{
let vec = Array("abcdefghkmnpqrstuvwxyz0123456789")
let encoded = Array(uti).suffix(from: 5)
var result: [UInt8] = []
@makotom
makotom / ndpproxy.sh
Last active July 3, 2024 02:14
Yet another implementation of IPv6 pass-through
#/usr/bin/bash
WANDEV='eth0'
LANDEV='br0'
while :
do
ip -6 neigh show dev $LANDEV | grep lladdr | grep -v -P ^fe80:: | sed -e 's/ .*$//' | while read addr
do
if [ "$(ip -6 neigh show proxy to $addr dev $WANDEV)" == "" ]
@zeitiger
zeitiger / gist:1387f7d996f64b493608
Last active March 30, 2022 08:11
JSExportAs Workaround in Swift (simplified code example)
public typealias myFunctionDefAlias = (@objc_block (String, String, NSNumber) -> Void)
@objc
public protocol MyJSExportProtocol: JSExport {
// JSExportAs alternative in Swift via closure
var myFunction:myFunctionDefAlias? {get}
}
@objc
public class MyJSExportClass: NSObject, MyJSExportProtocol {