Skip to content

Instantly share code, notes, and snippets.

View brianteachman's full-sized avatar

Brian Teachman brianteachman

View GitHub Profile
@brianteachman
brianteachman / rot13.js
Created September 29, 2012 15:51
ROT-13 letter substitution cipher. For obfuscation because of virtually absent, level of security.
//http://en.wikipedia.org/wiki/Rot13
//var name = "Brian Teachman";
//var token = "Oevna Grnpuzna";
function rot13(name) {
var lt1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
var lt2 = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm ";
var result = "";
@brianteachman
brianteachman / Rot13.js
Created September 29, 2012 17:06
ROT-13 letter substitution cipher Constructor. Provides ROT-13 encoding and decoding.
function Rot13() {
var result = "";
var decode = false;
var lookup = function(char, i) {
var lt1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
var lt2 = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm ";
var orig = (decode) ? lt2: lt1;
var enc = (decode) ? lt1: lt2;
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
@brianteachman
brianteachman / php_time_profiler.php
Created October 1, 2012 22:41
PHP timimg script using microtime() and BC Math
#!/usr/bin/php
<?php
$profile = function() {
static $start = '0';
list($timestamp, $microseconds) = split(' ', microtime());
$current = bcadd($timestamp, $microseconds, 4);
if ($start === '0') {
$start = $current;
return;
}
@brianteachman
brianteachman / password_scorer.js
Created December 4, 2012 00:40
Password Scorer
// http://net.tutsplus.com/tutorials/javascript-ajax/meet-crockford%E2%80%99s-jscheck/
(function () {
var PasswordScorer = {};
PasswordScorer.score = function (password) {
var len = password.length,
lengthScore = 0,
letterScore = 0,
chars = {}
if (len >= 21) { lengthScore = 7; }
##
# My solution is not the shortest, but it makes sense to me.
##
def print_abacus(value):
abacus, rod, slices = '', '00000*****', []
for char in str(value):
# is there any reason not to use a list of dictionaries?
slices.append({'left': (10 - int(char)), 'right': (10 - (10 - int(char)))})
rows = len(slices) # does it make sense to cache here?
if rows < 10:
@brianteachman
brianteachman / stop_words.php
Created January 13, 2013 08:21
A PHP array of common English stop words that can loaded by an include statement.
<?php
//http://www.ranks.nl/resources/stopwords.html
return $stop_words = array(
'a',
'about',
'above',
'after',
'again',
'against',
'all',
@brianteachman
brianteachman / python-nmap_example.py
Created March 7, 2013 18:57
Quick port scan script in python using python-nmap.
# http://xael.org/norman/python/python-nmap
# lets check for common ports using nmap
import nmap
nmScan = nmap.PortScanner()
nmScan.scan('127.0.0.1', '0-1023')
for port in nmScan['127.0.0.1']['tcp']:
thisDict = nmScan['127.0.0.1']['tcp'][port]
print 'Port ' + str(port) + ': ' + thisDict['product'] + ', v' + thisDict['version']
@brianteachman
brianteachman / RESUME.md
Last active March 8, 2025 23:00
Brian Teachman's resume

Brian Teachman | Web Developer

Bellingham, WA, USA | [email protected]

SKILLS & EXPERTISE

Agile Development: web sites/applications/services, modules, plugins, widgets

Small Business Portals: CRMs, Storefronts, Mapping Applications

Personal Sites: Blogs, Portfolio's, Informational Sites

@brianteachman
brianteachman / read_deep_cookie.php
Last active December 29, 2015 05:49
Return an array stored in cookie