Skip to content

Instantly share code, notes, and snippets.

View jas-'s full-sized avatar
🏃‍♂️

Jason Gerfen jas-

🏃‍♂️
View GitHub Profile
@jas-
jas- / laag-one2many.sql
Last active August 29, 2015 14:01
SQLite Structure & Contents for small collection
-- 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 August 29, 2015 14:04
LAMP stack w/ DHCPD 802.1Q Configuration

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 June 21, 2011 16:22
PHP salter
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- / jQuery.blank.js
Last active September 27, 2015 17:08
jQuery method plug-in framework
(function($){
$.fn.tool = function(method) {
var defaults = defaults || {
foo: 'bar'
};
var methods = methods || {
init: function(opts) {
@jas-
jas- / .bashrc
Last active September 27, 2015 23:48
Hardening stuff
# 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 December 14, 2011 21:55
PHP OpenSSL patch implementing SPKAC handling
#!/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 January 9, 2012 17:45
Retreive 'real' IP of remote clients
/**
* @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 January 12, 2012 16:45
Luh algorithm in various languages
#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 October 7, 2015 03:38
Threaded TLS server
module.exports = {
/* returns tls authorization */
_a: function(o)
{
return o.authorized ? 'authorized' : 'unauthorized: '+o.authorizationError;
},
/* returns connecting host */
_host: function(o)
@jas-
jas- / json-output.json
Last active November 1, 2015 16:27
libnmap output examples (both make use of the examples/accuracy.js example script)
{
"172.17.190.241-255": {
"$": {
"scanner": "nmap",
"args": "nmap --host-timeout=900s -T0 --max-retries 10 --ttl 200ms --scan-delay 10s --max-rate 30 -oX - -p1-1024 172.17.190.241-255",
"start": "1445783304",
"startstr": "Sun Oct 25 14:28:24 2015",
"version": "6.40",
"xmloutputversion": "1.04"
},