Skip to content

Instantly share code, notes, and snippets.

View louismullie's full-sized avatar

L louismullie

View GitHub Profile
@jackkinsella
jackkinsella / blueprint_to_bootstrap.sh
Created July 25, 2012 14:39
Convert Blueprint to Twitter Bootstrap Span Classes - one-liner
# Commit before using this script since it changes your files permanently.
# Run from your web app's root folder.
ack -l "span-[0-9][0-9]?" | xargs sed -i "" -E 's/span-([0-9]{1,2})/span\1/'
@dacbd
dacbd / crypt.js
Created September 27, 2012 20:05
SJCL ecc encrypt/decrypt
var data = {
herp: "derp"
};
//Make the keys.
var temp = sjcl.ecc.elGamal.generateKeys(384, 1);
//to encrypt with publickey:
var pubjson = temp.pub.serialize();
var point = sjcl.ecc.curves["c" + pubjson.curve].fromBits(pubjson.point);
@mrichie
mrichie / gist:4043266
Created November 9, 2012 02:05 — forked from jfirebaugh/gist:4007524
Installing Ruby 2.0.0-preview1 with RVM on OS X
# First, make sure that you have the most recent rvm. Several bugs with 2.0.0-preview1
# have recently been fixed.
#
# Second, the openssl that comes with MacOS is too old for Ruby 2.0. You need to install
# a newer one with homebrew or the rvm pkg command.
# Option 1, with homebrew openssl:
brew update
brew install openssl
@HarryR
HarryR / cbcmac.py
Created February 22, 2013 22:47
Injects 2 blocks into a CBC-MAC stream with the resulting MAC being the same. Aka the 'CBC-MAC splicing attack'
#!/usr/bin/env python
from Crypto.Cipher import AES
from Crypto.Util.strxor import strxor
from binascii import hexlify
K = '0123456789abcdef'
cipher = AES.new(K, AES.MODE_ECB)
# Original Message
@dannvix
dannvix / intercept-https-with-python-mitmproxy.md
Last active March 6, 2025 01:41
Intercept and manipulate HTTPs traffic with Python and mitmproxy

Intercepts HTTPs Traffic with Python & mitmproxy

Warning

This Gist is created in 2014, and it's highliy outdated now, according to one of mitmproxy's manjor contributor (check his comment below). Thanks for letting us know, @mhils!

Introduction

Modern applications usually make use of back-end API servers to provide their services. With a non-transparent HTTPs proxy, which intercepts the communication between clients and servers (aka the man-in-the-middle scheme), you can easily manipulate both API requests and responses.

@superwills
superwills / OpenSSL RSA encryption sample
Last active November 2, 2022 09:45
Base64 encoding and RSA encryption sample
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <openssl/rsa.h>
#include <openssl/engine.h>
#include <openssl/pem.h>
// I'm not using BIO for base64 encoding/decoding. It is difficult to use.
// Using superwills' Nibble And A Half instead
@tarcieri
tarcieri / ecb_test.rb
Last active June 30, 2021 14:54
Either ECB mode is broken in Ruby OpenSSL or I'm retarded...
#!/usr/bin/env ruby
require 'openssl'
# AES-128 ECB mode test vectors
# Taken from: http://www.inconteam.com/software-development/41-encryption/55-aes-test-vectors#aes-ecb-128
KEY = ["2b7e151628aed2a6abf7158809cf4f3c"].pack("H*")
PLAINTEXT = ["6bc1bee22e409f96e93d7e117393172a"].pack("H*")
CIPHERTEXT = ["3ad77bb40d7a3660a89ecaf32466ef97"].pack("H*")
@shovon
shovon / README.md
Last active April 18, 2019 08:37
An install script for LLVM and Clang v3.2.

Installing LLVM and Clang v3.2 on OS X

I'm assuming you need this version for Emscripten.

Don't worry, this script will not override your current installation of LLVM and Clang.

Be sure that you have:

  • read this README file
  • read this README file
@jiahao
jiahao / Hypergeometric.jl
Created October 18, 2013 21:13
Hypergeometric random variate generators implemented in Julia
# Hypergeometric random variate generators
#
# (c) 2013 Jiahao Chen <[email protected]>
#
# This file implements several random variate generators as described in the
# reference paper.
#
# Algorithm Function
# HBU randhg_hbu
# HIN randhg_hin
@kujohn
kujohn / portforwarding.md
Last active April 3, 2025 15:00
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like: