Skip to content

Instantly share code, notes, and snippets.

View abcarroll's full-sized avatar

A.B. Carroll III abcarroll

View GitHub Profile
# root@lighthouse; ~
; fdisk /dev/md0
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
/dev/md0: device contains a valid 'ext3' signature; it is strongly recommended to wipe the device with wipefs(8) if this is unexpected, in order to avoid possible collisions
Device does not contain a recognized partition table.
/**
* Emulates a PHP PSR-3-like interface.
*
* @type {{emergency: $log.emergency, alert: $log.alert, critical: $log.critical, error: $log.error, warning: $log.warning, notice: $log.notice, info: $log.info, debug: $log.debug, log: $log.log}}
*/
var Logger = function () {
this.logger = {};
var psrToConsole = {
@abcarroll
abcarroll / usrlocalbin_mtime.php
Created April 24, 2016 00:32
Shell utility to return the relative mtime for a file or directory
#!/usr/bin/env php
<?php
/*
/* mtime: version 1.0
/*
/* (C) Copyright 2016 A.B. Carroll <[email protected]>
/* MIT License.
/*
/*/

The GNL is not Lunucks Specific Private License

Copyright (C) <year> <copyright holder(s)>

No permission is hereby granted to any person (the "Recipient") obtaining a copy of this software, associated documentation, or advertising materials, (the "Software) by the copyright holders (the "Author").

The recipient may NOT, under any circumstances, ever ever -- EVER -- use, copy, modify, merge, publish, distribute, sublicense, sell, or even so much as think about this software, in source or

Enormous Switch vs Large Group of Methods

A primer on benchmarking and O(1) vs O(n) lookups

When writing Hubbub, a PHP-IRC bot/BNC, the IRC parser is a large collection of specialized methods, for example:

private function parse_rpl_isupport($line) { 
    // do some parsing...
    return $line;
}
# ~/.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
<?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";
}
<?php
class test {
public function __construct(Array $dependants) {
array_walk($dependants, function ($dVal, $dKey) {
$this->$dKey = $dVal;
});
$this->init();
$this->run();
<?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
*/