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 19, 2024 02:55
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
@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 salt.prod@mailinator.com"

@jtbandes
jtbandes / decode-dyn-uti.swift
Last active January 7, 2024 05:29
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 June 17, 2016 04:44
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 {
@vilhalmer
vilhalmer / gist:3052f7e9e7f34b92a40f
Created November 1, 2014 01:28
NSVisualEffectView undocumentation
NSVisualEffectMaterial constants, and the undocumented materials they coorespond to in various modes:
+----------------------+-------+----------+------+---------+
| MATERIAL # | LIGHT | LIGHT EM | DARK | DARK EM |
+----------------------+-------+----------+------+---------+
| | | | | |
| 0 - Appearance Based | 3 | 3 | 5 | 5 |
| | | | | |
| 1 - Light | 3 | 3 | 3 | 3 |
| | | | | |
| 2 - Dark | 4 | 4 | 4 | 4 |
@arosenb2
arosenb2 / BasicChildBrowser.swift
Last active September 9, 2017 20:50
A child web browser without navigation features in iOS using WKWebView in Swift
import Foundation
import UIKit
import Webkit
class BasicChildBrowser:UIViewController, WKNavigationDelegate {
let web = WKWebView()
let toolbar = UIToolbar()
let progressSpinner = UIActivityIndicatorView(activityIndicatorStyle: .White)
let progressBar = UIProgressView(progressViewStyle: .Bar)