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
@kennethreitz
kennethreitz / 0_urllib2.py
Created May 16, 2011 00:17
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@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
@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] = []
@sarg
sarg / README.md
Last active November 5, 2023 10:43
rk30xx loader image unpacker

Obtaining RK3066 boot ROM.

Here are my steps.

At first, I took a look to RK30xxLoader(L)_V1.18.bin. This file appears in update.img for my device. So, I unpacked update.img using rk29Kitchen.

strings on that file returns nothing interesting, so I assumed the file is crypted

@igmar
igmar / extensions.lua
Created November 13, 2012 15:55
Asterisk LUA dialplan
require("lsqlite3")
-- Igmar: Wanneer closen we dat DB object eigenlijk ?
db = sqlite3.open('/etc/asterisk/users.sqlite')
--CONSOLE = "Console/dsp" -- Console interface for demo
--CONSOLE = "DAHDI/1"
--CONSOLE = "Phone/phone0"
TRUNK = "DAHDI/G1"
@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

@weakish
weakish / boot-from-USB-macppc.markdown
Created January 7, 2011 11:16
Boot from USB on a open firmware #mac

Enter into Open Firmware (hold down Command+Option+o+f when power on), and type:

boot ud:,\\:tbxi
@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 {
@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)