Skip to content

Instantly share code, notes, and snippets.

View abcarroll's full-sized avatar

A.B. Carroll III abcarroll

View GitHub Profile
@abcarroll
abcarroll / rtunnel-auto
Last active August 29, 2015 14:23
Attempts to maintain a reverse ssh tunnel
#!/bin/bash
#
# rtunnel-auto: (C) Copyright 2014-2015 A.B. Carroll <[email protected]>
#
# On the remote server
# AllowTcpForwarding must be configured in order for tunneling to work.
# If LOCAL_HOST is an IP address that is local to the server this script
# is running on, it can be set to either 'yes' or 'local'.
@abcarroll
abcarroll / makeStatistics.php
Created July 4, 2015 10:42
Make a hopefully pronounceable word based on vowel, constant patterns. Patterns are pregenerated from analyzing dictionary files.
<?php
// A.B. Carroll, <[email protected]>
// "Do whatever the fuck you want license"
// Generates a 'statistics chunk' for use in pronounceable word generation
// It's a one-time generation, so it doesn't need to be fast.
$file = file('/usr/share/dict/american-english');
$patterns = [];
@abcarroll
abcarroll / countsheep.bash
Created September 4, 2015 08:37
Countdown with
countsheep(){
hr=$1
min=$2
sec=$3
if [ -z "$4" ]
then
prefix=""
else
prefix="$4"
@abcarroll
abcarroll / HTTP Cookie header parser
Last active September 12, 2015 08:39 — forked from pokeb/HTTP Cookie header parser
Quick and dirty HTTP cookie header parser in PHP
@abcarroll
abcarroll / sleepcountdown.sh
Last active December 5, 2015 08:05
Counts down a long sleep
#!/bin/bash
# Written by A.B. Carroll <[email protected]>
# Use as:
# sleepcountdown HOUR MIN SEC "Optional Prefix"
# Example:
# sleepcountdown 00 00 10 "Time until next run: "
# echo "Done with first countdown!"
# sleepcountdown 01 00 05 "Time until next run: "
# echo "Done with second countdown!"
<?php
/*
* (C) Copyright 2015 A.B. Carroll <[email protected]>. MIT or BSD License - your choice.
*/
class Utility {
/**
* Converts either a array of integers or string of comma-separated integers to a natural english range, such as "1,2,3,5" to "1-3, 5". It also supports
<?php
/**
* Class Bootstrap
*/
class Bootstrapper {
/**
* Whether or not to directly 'echo' debugging information. This is so close to the start procedures, logging facilities are not yet created.
* @const bool VERBOSE
*/
<?php
class test {
public function __construct(Array $dependants) {
array_walk($dependants, function ($dVal, $dKey) {
$this->$dKey = $dVal;
});
$this->init();
$this->run();
<?php
// Just showing you: say nonexistent had defined a variable called $foo that is a boolean, we can hint that too
include 'nonexistent.php';
/** @var bool $foo */
if($foo) { // this won't say undefined variable in the editor!
echo "foo was true in nonexistent.php";
}
# ~/.tmux.conf
###########################################################################
# Change prefix from default (C-b) to C-g
# C-g doesn't interfere with emacs-style editing keys
#unbind -n C-b
#unbind -n C-a
#set -g prefix C-a