Skip to content

Instantly share code, notes, and snippets.

@tmiz
tmiz / build_openssl_dylib.sh
Last active November 1, 2023 13:18
Build latest OpenSSL Universal Binary on OSX
#!/bin/bash
OPENSSL_VERSION="1.0.1g"
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_x86_64
cd openssl_i386
@yinyin
yinyin / endian.h
Created March 13, 2012 09:51
BSD/Linux-like <endian.h> for MacOS X
#ifndef __FINK_ENDIANDEV_PKG_ENDIAN_H__
#define __FINK_ENDIANDEV_PKG_ENDIAN_H__ 1
/** compatibility header for endian.h
* This is a simple compatibility shim to convert
* BSD/Linux endian macros to the Mac OS X equivalents.
* It is public domain.
* */
#ifndef __APPLE__
@yamaya
yamaya / xcode-clang-vers
Last active April 2, 2025 00:16
Xcode clang version record
# Xcode 4.3.3
Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
# Xcode 4.3.2
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix
@sindresorhus
sindresorhus / git-dirty-checks.md
Created October 16, 2012 11:20
Benchmark results of the fastest way to check if a git branch is dirty

Tested against the WebKit git repo by entering the repo with 1 file dirty.


git diff --quiet --ignore-submodules HEAD # Will tell if there are any uncomitted changes, staged or not.
0.6 sec

git diff-index --quiet HEAD # Only tracked
2 sec

@joemiller
joemiller / netpps.sh
Last active January 12, 2024 15:39
shell: quick linux scripts for showing network bandwidth or packets-per-second
#!/bin/bash
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth0
echo
echo shows packets-per-second
@kyanny
kyanny / gist:5387270
Created April 15, 2013 10:47
unpack .crx file
irb(main):008:0> crx = open('emoine.crx', 'rb')
=> #<File:emoine.crx>
irb(main):009:0> magic = crx.read(4)
=> "Cr24"
irb(main):010:0> version = crx.read(4).unpack("i*")
=> [2]
irb(main):011:0> public_key_length = crx.read(4).unpack("i*")
=> [162]
irb(main):012:0> signature_length = crx.read(4).unpack("i*")
=> [128]
@addyosmani
addyosmani / README.md
Last active May 10, 2025 11:24 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@pudquick
pudquick / parse_pbzx2.py
Created April 8, 2015 05:27
A pbzx stream decoder for the format found within Yosemite package payloads.
# v2 pbzx stream handler
# My personal writeup on the differences here: https://gist.github.com/pudquick/29fcfe09c326a9b96cf5
#
# Pure python reimplementation of .cpio.xz content extraction from pbzx file payload originally here:
# http://www.tonymacx86.com/general-help/135458-pbzx-stream-parser.html
#
# Cleaned up C version (as the basis for my code) here, thanks to Pepijn Bruienne / @bruienne
# https://gist.github.com/bruienne/029494bbcfb358098b41
import struct, sys
@junefrench
junefrench / RE_GEX.md
Last active August 29, 2015 14:19
Writeup of RE GEX challenge from PlaidCTF 2015

REG EX

Writeup

This is a writeup of the reversing challenge 'REG EX' from PlaidCTF 2015.

The challenge provided two files: a python server program and a crazy-huge regex (see regex.txt). The python server is very basic: it simply listens for a connection, prompts for a 'key', and then checks whether the key matches the regex. It will then send the flag, but only if the provided key did NOT match the regex.

After the initial shock of looking at many screenfulls of regex, it actually breaks down into simple chunks. The regex consists of a single group which must match the entire string (^(...)$), containing a number of alternatives. Because we need to find a string which does not match the regex, we need to ensure that none of the alternatives match our string. The first alternative (.*[^plaidctf].*) will match any string which contains any character not in 'plaidctf', so we know our solution will contain only those characters. The second two alternatives (.{,170}|.{172,}) will match any string