Skip to content

Instantly share code, notes, and snippets.

View randombit's full-sized avatar

Jack Lloyd randombit

View GitHub Profile
@stong
stong / twitter.txt
Last active April 29, 2024 15:53
Twitter ublock rules
twitter.com##div[aria-label="Trending"]
twitter.com##aside[aria-label="Who to follow"]
twitter.com##a[aria-label="Search and explore"]
twitter.com##svg[aria-label="Verified account"]
twitter.com##a[aria-label="Communities"]
twitter.com##a[aria-label="Verified Orgs"]
twitter.com##a[aria-label="Top Articles"]
twitter.com##a[aria-label^="Notifications"]
! 2023-09-05 https://twitter.com
@pakt
pakt / rdwr.py
Created August 15, 2015 10:59
Direct read/write access to Python's memory
#
# read/write access to python's memory, using a custom bytearray.
# some code taken from: http://tinyurl.com/q7duzxj
#
# tested on:
# Python 2.7.10, ubuntu 32bit
# Python 2.7.8, win32
#
# example of correct output:
# inspecting int=0x41424344, at 0x0228f898
@s3rvac
s3rvac / double-dispatch.cpp
Last active May 6, 2024 08:46
An example of using double dispatch in C++ to implement expression evaluation without type casts.
// $ g++ -std=c++14 -pedantic -Wall -Wextra double-dispatch.cpp -o double-dispatch
// $ ./double-dispatch
//
// Also works under C++11.
#include <iostream>
#include <memory>
#if __cplusplus == 201103L
namespace std {
@michaljemala
michaljemala / tls-client.go
Last active July 18, 2024 11:40
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@sneves
sneves / ct32.c
Last active December 28, 2021 19:43
/*
Constant-time integer comparisons
Written in 2014 by Samuel Neves <sneves@dei.uc.pt>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with
@klutzy
klutzy / main.rs
Last active December 23, 2015 12:19
for extern "C++"
extern mod syntax;
extern mod rustc;
pub use syntax::ast;
pub use rustc::middle::ty;
pub use rustc::middle::ty::t;
fn cpp_arg_mangle(arg: t) -> ~str {
let arg = ty::get(arg);
match arg.sty {
@CodesInChaos
CodesInChaos / Code
Last active December 20, 2015 17:59
function LoginHash(string password, byte[] salt, int memSize, int queryCount, int maxParallelism)
return KDF(password, salt, memSize, queryCount, maxParallelism, "LoginVerification", 16)
function KDF(string password, byte[] salt, int memSize, int queryCount, int maxParallelism, string info, int outputSize)
masterKey = ComputeMasterKey(password, salt, memSize, queryCount, maxParallelism)
return HKDF-Expand(masterKey, info, outputSize) // For short outputs this is simply HMAC-SHA-256(masterKey, info || 0x01).Truncate(outputSize)
function ComputeMasterKey(string password, byte[] salt, int memSize, int queryCount, int maxParallelism)
requires memSize mod 16 = 0
requires memSize > 0