This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys, socket, struct | |
import PIL, PIL.Image, PIL.ImageOps | |
DENSITY_MIN = 0 | |
DENSITY_LIGHT = 1 | |
DENSITY_NORMAL = 2 | |
DENSITY_HEAVY = 3 | |
DENSITY_MAX = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os, tempfile, shutil, subprocess, ctypes | |
class BaseAsmFunc(object): | |
def __init__(self, sfunc): | |
self.source = sfunc.__doc__ | |
self._tmp = tempfile.mkdtemp() + os.sep | |
self.compile(self.source) | |
def compile(self, source): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Algorithm to process Wiimote IR tracking data into a usable pointer position | |
* by tracking the sensor bar. | |
* | |
* Copyright (c) 2008-2011 Hector Martin "marcan" <marcan@marcan.st> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import detect | |
# Original constants | |
primes = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, | |
103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167] | |
prints = [6, 30, 126, 1026, 5658, 107286, 199410, 8388606, 536870910, 2147483646, 67109890, 2199023255550, | |
8796093022206, 140737488355326, 5310023542746834, 576460752303423486, 1455791217086302986, | |
147573952589676412926, 20052041432995567486, 6041388139249378920330, 207530445072488465666, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
# Credit: https://crypto.stackexchange.com/questions/52292/what-is-fast-prime | |
generators = [ | |
(2, 11), (6, 13), (8, 17), (9, 19), (3, 37), (26, 53), (20, 61), (35, 71), | |
(24, 73), (13, 79), (6, 97), (51, 103), (53, 107), (54, 109), (42, 127), | |
(50, 151), (78, 157), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys | |
KEYINT = 30 | |
# Encode your input like this (example): | |
# x264 --crf 20 --keyint 30 --min-keyint 30 --bframes 1 --no-b-adapt <input> -o <output.h264> | |
# Produces display order IBPBPBP...BPBPP|IBPBPBP...BPBPP|... | |
# Decoding (file) order IPBPBPB...PBPBP|IPBPBPB...PBPBP|... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# | |
# Simple Bloom filter implementation in Python 3 | |
# Copyright 2017 Hector Martin "marcan" <marcan@marcan.st> | |
# Licensed under the terms of the MIT license | |
# | |
# Written to be used with the Have I been pwned? password list: | |
# https://haveibeenpwned.com/passwords | |
# | |
# Download the pre-computed filter here (968MB, k=11, false positive p=0.0005): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* SMBLoris attack proof-of-concept | |
* | |
* Copyright 2017 Hector Martin "marcan" <marcan@marcan.st> | |
* | |
* Licensed under the terms of the 2-clause BSD license. | |
* | |
* This is a proof of concept of a publicly disclosed vulnerability. | |
* Please do not go around randomly DoSing people with it. | |
* | |
* Tips: do not use your local IP as source, or if you do, use iptables to block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# PNG Gamma trick (by @marcan42 / marcan@marcan.st) | |
# | |
# This script implements an improved version of the gamma trick used to make | |
# thumbnail images on reddit/4chan look different from the full-size image. | |
# | |
# Sample output (SFW; images by @Miluda): | |
# https://mrcn.st/t/homura_gamma_trick.png | |
# https://www.reddit.com/r/test/comments/6edthw/ (click for fullsize) | |
# https://twitter.com/marcan42/status/869855956842143744 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/boot/bzImage | |
# Linux kernel userspace initialization code, translated to bash | |
# (Minus floppy disk handling, because seriously, it's 2017.) | |
# Not 100% accurate, but gives you a good idea of how kernel init works | |
# GPLv2, Copyright 2017 Hector Martin <marcan@marcan.st> | |
# Based on Linux 4.10-rc2. | |
# Note: pretend chroot is a builtin and affects the current process | |
# Note: kernel actually uses major/minor device numbers instead of device name |