Skip to content

Instantly share code, notes, and snippets.

Avatar
🏃‍♂️

Jason Gerfen jas-

🏃‍♂️
View GitHub Profile
@jas-
jas- / laag-one2many.sql
Last active Aug 29, 2015
SQLite Structure & Contents for small collection
View laag-one2many.sql
-- Handles dates
-- |_ id referenced by dates2objects as foreign key
DROP TABLE IF EXISTS `dates`;
CREATE TABLE `dates` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
`date` INT(4) UNIQUE DEFAULT NULL
);
-- Handles origin
-- |_ id referenced by origin2objects as foreign key
@jas-
jas- / readme.md
Last active Aug 29, 2015
LAMP stack w/ DHCPD 802.1Q Configuration
View readme.md

802.1Q networking, LAMP stack, TFPT & MySQL user permissions

Details on the current configuration of tyr.example.com can be found below. 10/11/2012

Kernel

Raid

Details for the raid1 configuration are as follows:

fdisk

@jas-
jas- / _salt()
Created Jun 21, 2011
PHP salter
View _salt()
function _salt($string, $len=null)
{
return (!empty($len)) ?
hash('sha512', str_pad($string, (strlen($string) + $len),
substr(hash('sha512', $string),
round((float)strlen($string)/3, 0,
PHP_ROUND_HALF_UP),
($len - strlen($string))),
STR_PAD_BOTH)) :
hash('sha512', substr($string,
@jas-
jas- / 4GBISO
Last active Sep 26, 2015
4.0GB Empty ISO
View 4GBISO
dd if=/dev/zero of=file.iso bs=516096 seek=9182 count=0
@jas-
jas- / jQuery.blank.js
Last active Sep 27, 2015
jQuery method plug-in framework
View jQuery.blank.js
(function($){
$.fn.tool = function(method) {
var defaults = defaults || {
foo: 'bar'
};
var methods = methods || {
init: function(opts) {
@jas-
jas- / .bashrc
Last active Sep 27, 2015
Hardening stuff
View .bashrc
# Hostname
h=`hostname`
# Command to read input & mask it
cmd='read -sp "Enter password: " pass'
# Path to aide integrity tool
a="/usr/bin/aide"
# Path to aide policy database
adb="/var/lib/aide"
@jas-
jas- / openssl-spki-cli.php
Created Dec 14, 2011
PHP OpenSSL patch implementing SPKAC handling
View openssl-spki-cli.php
#!/usr/local/bin/php
<?php
echo "Generating private key...";
$key = openssl_pkey_new(array('digest_alg' => 'sha512',
'private_key_type' => OPENSSL_KEYTYPE_RSA,
'private_key_bits' => 2048));
echo "done\n";
echo "============================\n";
@jas-
jas- / real-ip.php
Created Jan 9, 2012
Retreive 'real' IP of remote clients
View real-ip.php
/**
* @function _getRealIPv4
* @abstract Try all methods of obtaining 'real' IP address
*/
function _getRealIPv4()
{
return (getenv('HTTP_CLIENT_IP') && $this->_ip(getenv('HTTP_CLIENT_IP'))) ?
getenv('HTTP_CLIENT_IP') :
(getenv('HTTP_X_FORWARDED_FOR') && $this->_forwarded(getenv('HTTP_X_FORWARDED_FOR'))) ?
$this->_forwarded(getenv('HTTP_X_FORWARDED_FOR')) :
@jas-
jas- / luhn.c
Created Jan 12, 2012
Luh algorithm in various languages
View luhn.c
#include <string.h>
bool _vCC(char *cc)
{
int n=1;
int d, t=0;
int i=strlen(cc);
string d;
if ((cc!=0)||(strlen(cc)!=0)){
for (i>0;i--){
d=substr(cc, i-1, 1);
@jas-
jas- / lib.js
Last active Oct 7, 2015
Threaded TLS server
View lib.js
module.exports = {
/* returns tls authorization */
_a: function(o)
{
return o.authorized ? 'authorized' : 'unauthorized: '+o.authorizationError;
},
/* returns connecting host */
_host: function(o)