Skip to content

Instantly share code, notes, and snippets.

View kwhat's full-sized avatar

Alex Barker kwhat

View GitHub Profile
I was drawn to programming, science, technology and science fiction
ever since I was a little kid. I can't say it's because I wanted to
make the world a better place. Not really. I was simply drawn to it
because I was drawn to it. Writing programs was fun. Figuring out how
nature works was fascinating. Science fiction felt like a grand
adventure.
Then I started a software company and poured every ounce of energy
into it. It failed. That hurt, but that part is ok. I made a lot of
mistakes and learned from them. This experience made me much, much
@RandomInsano
RandomInsano / fuzzer.py
Created September 24, 2016 18:14
Serial fuzzer written in Python3
#!/usr/bin/env python3
import serial
import binascii
#open serial
ser = serial.Serial(
port='/dev/tty.usbserial-A6005kdh',
baudrate=115200,
timeout=0.005
@TheZ3ro
TheZ3ro / crypto_env.js
Created September 28, 2015 14:01
Detect the Native Crypto Environment in JavaScript
var CryptoEnv = {};
(function () {
var exports = (typeof module !== 'undefined' && module.exports) || window.CryptoEnv;
var node = (typeof module !== 'undefined');
var crypto;
if(node){
crypto = require('crypto');
}else{
crypto = (window.crypto && crypto.subtle) ||
@samthomson
samthomson / filters.php
Created August 16, 2015 09:16
Case insensitive routing in laravel
App::before(function($request)
{
// if any characters in the route path are uppercase
if(ctype_upper(preg_replace('/[^\da-z]/i', '', $request->path()))){
// extract the path section of the url (the route) from the url and convert it to lowercase
$sNewRelativePath = str_replace($request->path(), strtolower($request->path()), $request->fullUrl());
// now redirect the user with a 301 to the lower case route
return \Illuminate\Support\Facades\Redirect::to($sNewRelativePath, 301);
}
});
@renatolfc
renatolfc / android-client.ovpn
Created December 28, 2014 18:59
A sample OpenVPN client configuration file in the unified format
client
dev tun
remote example.com
resolv-retry infinite
nobind
persist-key
persist-tun
ca [inline]
cert [inline]
key [inline]
@krakjoe
krakjoe / pool.md
Last active January 30, 2020 12:33
Pooling

Easy pthreads Pools

The final solution !!

Since the first version of pthreads, PHP has had the ability to initialize Worker threads for users. Onto those Worker threads are stacked objects of class Stackable for execution concurrently.

The objects stacked onto workers do not have their reference counts changed, pthreads forces the user to maintain the reference counts in userland, for the extremely good reason that this enables the programmer to keep control of memory usage; and so, execute indefinitely.

This is the cause of much heartache for newcomers to pthreads; if you do not maintain references properly you will, definitely, experience segmentation faults.

@krakjoe
krakjoe / pthreads.md
Last active September 24, 2024 14:50
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
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
@svoisen
svoisen / Of Mice and Men
Created March 21, 2013 19:16
Information on low-level scrolling events on Mac OS X
From the WebKit documentation at:
http://www.opensource.apple.com/source/WebKit/WebKit-7533.16/chromium/src/mac/WebInputEventFactory.mm
// Of Mice and Men
// ---------------
//
// There are three types of scroll data available on a scroll wheel CGEvent.
// Apple's documentation ([1]) is rather vague in their differences, and not
// terribly helpful in deciding which to use. This is what's really going on.
//
@jpatters
jpatters / HeidiDecode.js
Last active November 11, 2024 15:09
Decodes a password from HeidiSQL. HeidiSQL passwords can be found in the registry. Use File -> Export Settings to dump all settings. Great for if you forget a password.
function heidiDecode(hex) {
var str = '';
var shift = parseInt(hex.substr(-1));
hex = hex.substr(0, hex.length - 1);
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift);
return str;
}
document.write(heidiDecode('755A5A585C3D8141786B3C385E3A393'));