Skip to content

Instantly share code, notes, and snippets.

View brad-jones's full-sized avatar

Brad Jones brad-jones

View GitHub Profile
@brad-jones
brad-jones / scgi-server.php
Created January 23, 2014 06:24
The SCGI protocol is a replacement for the Common Gateway Interface (CGI) protocol. It is a standard for applications to interface with HTTP servers. It is similar to FastCGI but is designed to be easier to implement. This is a PHP Implementation.
<?php
/**
* Class: MyListener
* =============================================================================
* This sets up the underlying socket server.
* Using all this nice new LibEvent code which is now part of PHP.
*/
class MyListener
{
@brad-jones
brad-jones / MyConnection.php
Created January 29, 2014 06:25
Daemonized Scgi Server
<?php
/**
* Class: MyConnection
* =============================================================================
* This class works with an individual connection to our server.
* And deals more with the actual SCGI protocol.
*/
class MyConnection
{
/**
@brad-jones
brad-jones / get-passwords.php
Created February 24, 2014 05:48
IMAP/POP3 Password Recovery
<?php
// Read in the users to find passwords for.
$users = array();
foreach (file('users-to-find.txt') as $line)
{
$users[] = trim($line);
}
// Create the tcpdump command to search for all pop3 and imap login traffic
@brad-jones
brad-jones / DbDiff.php
Last active December 31, 2020 03:06
DbDiff
<?php
/**
* Class: DbDiff
* =============================================================================
* This class will output the SQL needed to transform db_1 into db_2 including
* DATA changes, not just schema changes!!! And it pretty fast, when run locally
* at least. I developed this to help me detect changes in CMS type databases
* like wordpress so I could create SQL migration and seeding scripts easily.
*
@brad-jones
brad-jones / oop.js
Last active August 29, 2015 14:05
Classes for browsers
/**
* !!! SEE: https://github.com/brad-jones/oop.js !!!
*
* Classes for browsers
* =============================================================================
* Like many others this is my attempt at creating a "classical" class in
* javascript. My motivations are because I like the look of a traditional
* class. A prototype class is just so segmented and verbose. Thats really all
* it comes down to because I could have fixed my IE bugs by dropping Writh's
* classical and just doing everything in native code. I felt like that was
@brad-jones
brad-jones / jpegfit.php
Created August 29, 2014 02:47
JPEG Compress to target Filesize
<?php
/**
* JpegFit Class
* 2007-04-12 Image Resource getters and setters with examples
* 2007-03-29 First Version
*
* IMPORTANT NOTE
* There is no warranty, implied or otherwise with this software.
*
* LICENCE
@brad-jones
brad-jones / README.md
Last active August 29, 2015 14:14 — forked from peteboere/README.md
@brad-jones
brad-jones / Readme.md
Created February 6, 2015 06:09
Sublime Text Git Projects

Sublime Text Git Projects

The basic idea is to replicate the same sort of functionality that this atom plugin (https://github.com/prrrnd/atom-git-projects) provides but for Sublime.

I really like Atom for its feature set but its just still too slow. This was one of the things that I missed when I went back to using Sublime.

I tried to get this working as a Python Plugin but I couldn't work out how to

@brad-jones
brad-jones / hackpad-mod.js
Created February 23, 2015 06:15
Hackpad.com User Script
// ==UserScript==
// @name Hackpad.com User Script
// @version 0.1
// @description Forces the New Hackpad Button to Open in Current Tab/Window
// @author Brad Jones
// @include https://hackpad.com/*
// ==/UserScript==
$(document).ready(function()
{
@brad-jones
brad-jones / auto-configure-desktop.sh
Created March 25, 2015 02:57
Automating Linux Desktop with wmctrl
#!/bin/sh
# WMCTRL Desktop Automation script
# ================================
# Author: Brad Jones <[email protected]>
#
# I assume you know what wmctrl is, if not not see:
# https://sites.google.com/site/tstyblo/wmctrl/
#
# I also assume you actually read the documentation.
# I have tested this on Fedora 21 running cinnamon and it works great.