Skip to content

Instantly share code, notes, and snippets.

@krackers
krackers / reload_userChrome_css.js
Created February 5, 2023 04:31 — forked from jscher2000/reload_userChrome_css.js
Browser Console script to reload userChrome.css
/*
Code to paste and run in the Browser Console
Requires devtools.chrome.enabled => true in about:config
Tested in Firefox 68.0.1 on Windows
*/
// Create references to APIs we'll use
var ss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
var io = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var ds = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
@krackers
krackers / tlsprox.go
Created January 13, 2023 19:45 — forked from tam7t/tlsprox.go
Minimal TLS MITM transparent proxy
/* tlsprox - minimal tls MITM transparent proxy... in go!
* by @tam7t
*
* Usage:
* If we want to MITM https://example.com first get example.com's ip address
* then add localhost to /etc/hosts:
*
* 127.0.0.1 example.com
*
* > go build tlsprox.go
@krackers
krackers / Fantastical log messages
Created January 12, 2023 09:07 — forked from hjuutilainen/Fantastical log messages
Log messages by Fantastical (OS X)
19.11.2013 13.41.32,403 secd[540]: securityd_xpc_dictionary_handler Fantastical[1799] copy_matching The operation couldn’t be completed. (OSStatus error -34018 - client has neither application-identifier nor keychain-access-groups entitlements)
19.11.2013 13.41.32,403 Fantastical[1799]: SecOSStatusWith error:[-34018] The operation couldn’t be completed. (OSStatus error -34018 - Remote error : The operation couldn‚Äôt be completed. (OSStatus error -34018 - client has neither application-identifier nor keychain-access-groups entitlements))
19.11.2013 13.41.32,406 secd[540]: securityd_xpc_dictionary_handler Fantastical[1799] copy_matching The operation couldn’t be completed. (OSStatus error -34018 - client has neither application-identifier nor keychain-access-groups entitlements)
19.11.2013 13.41.32,406 Fantastical[1799]: SecOSStatusWith error:[-34018] The operation couldn’t be completed. (OSStatus error -34018 - Remote error : The operation couldn‚Äôt be completed. (OSStatus error -34018 - client has neith
@krackers
krackers / web-servers.md
Created January 3, 2023 20:54 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
//
// RVNReceiptValidation.m
//
// Created by Satoshi Numata on 12/06/30.
// Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved.
//
// This sample shows how to write the Mac App Store receipt validation code.
// Replace kRVNBundleID and kRVNBundleVersion with your own ones.
//
// This sample is provided because the coding sample found in "Validating Mac App Store Receipts"
@krackers
krackers / bundlelessApplication.m
Created December 7, 2022 17:36 — forked from karstenBriksoft/bundlelessApplication.m
NSApplication without Bundle
// compile using: clang -fobjc-arc -framework AppKit bundlelessApplication.m -o bundleLess
//
// opens a NSApplication with dock icon and menu bar. NSRunningApplication will return no bundleURL for it
//
// via http://stackoverflow.com/questions/8137538/cocoa-applications-from-the-command-line
// and http://casperbhansen.wordpress.com/2010/08/15/dev-tip-nibless-development/
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
@krackers
krackers / jSugar.js
Created May 26, 2022 05:38 — forked from pseudosavant/jSugar.js
Utility function that adds in some jQuery-like syntactic sugar
// jQuery-like syntactic sugar. Only queries for one element. Does not loop over multiple like jQuery
function $(query) {
if (typeof query === 'undefined') throw 'No query provided to $';
var el;
if (typeof query.nodeType === 'string') {
el = query;
} else if (typeof query === 'string' && query[0] === '<') {
const container = document.createElement('div');
container.innerHTML = query;
#import <Foundation/Foundation.h>
typedef uint64_t CGSSpace;
typedef uint64_t CGSManagedDisplay;
typedef int CGSConnection;
typedef enum _CGSSpaceSelector {
kCGSSpaceCurrent = 5,
kCGSSpaceOther = 6,
kCGSSpaceAll = 7
@krackers
krackers / dht-walkthrough.md
Created June 7, 2020 18:34 — forked from gubatron/dht-walkthrough.md
DHT walkthrough notes

DHT Walkthrough Notes

I've put together these notes as I read about DHT's in depth and then learned how the libtorrent implementation based on the Kademlia paper actually works.

What problem does this solve?

400,000,000,000 (400 billion stars), that's a 4 followed by 11 zeros. The number of atoms in the universe is estimated to be around 10^82. A DHT with keys of 160 bits, can have 2^160 possible numbers, which is around 10^48