Skip to content

Instantly share code, notes, and snippets.

View MichaelGooden's full-sized avatar

Michael Gooden MichaelGooden

  • Port Elizabeth, South Africa
View GitHub Profile
@MichaelGooden
MichaelGooden / Module.php
Created June 15, 2017 07:53
Time-ordered COMB UUIDs with Ramsey\UUID and Zend Framework 2/3 MVC
<?php
namespace Domain;
use Ramsey\Uuid\Codec\TimestampFirstCombCodec;
use Ramsey\Uuid\FeatureSet;
use Ramsey\Uuid\Generator\CombGenerator;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidFactory;
use Zend\EventManager\EventInterface;

Keybase proof

I hereby claim:

  • I am michaelgooden on github.
  • I am michaelgooden (https://keybase.io/michaelgooden) on keybase.
  • I have a public key whose fingerprint is B0E1 3273 B7C4 2B34 12CD 8474 909C 1E1B 489A D6BC

To claim this, I am signing this object:

:global counter
:global ssidarray {"It hurts when IP";"FBI Surveilance - Van 32";"NSA - Totally not watching";"Damn kids - Get off my LAN";"searching...";"TellMyWiFiLoveHer";"Router? I hardly know her";"Luke WiFi Walker";"The LAN Before Time";"The Promised LAN";"Silence of the LAN";"Wi believe I can Fi";"Winternet is coming";"Keep it on the Download";"Mom use this one";"Network Error";"Malware4Free";"winnerwinnerchickendinner";"Edward Snowden is here?";"Stop looking at my wifi";"Penny, get your own wifi";"MyWiFiSignalKillsBees";"Access Denied";"GetUrOwn";"Moe's Tavern";"SkyNet";}
:for counter from=0 to=[:len $ssidarray] do={
/interface wireless add comment="FunAP" ssid=($ssidarray->$counter) master-interface=wlan1 disabled=no name="FunAP$counter"
}
@MichaelGooden
MichaelGooden / he-tunnelserver-ping.sh
Last active May 1, 2020 09:50 — forked from n-st/he-tunnelserver-ping.sh
Check and compare ping times for all Hurricane Electric (tunnelbroker.net) IPv6 tunnel servers.
#!/bin/bash
tunservers="Hong_Kong,_HK:216.218.221.6 Singapore,_SG:216.218.221.42 Tokyo,_JP:74.82.46.6 Amsterdam,_NL:216.66.84.46 Berlin,_DE:216.66.86.114 Budapest,_HU:216.66.87.14 Frankfurt,_DE:216.66.80.30 London,_UK:216.66.80.26 London,_UK:216.66.88.98 Paris,_FR:216.66.84.42 Prague,_CZ:216.66.86.122 Stockholm,_SE:216.66.80.90 Warsaw,_PL:216.66.80.162 Zurich,_CH:216.66.80.98 Ashburn,_VA,_US:216.66.22.2 Chicago,_IL,_US:184.105.253.14 Dallas,_TX,_US:184.105.253.10 Denver,_CO,_US:184.105.250.46 Fremont,_CA,_US:72.52.104.74 Fremont,_CA,_US:64.62.134.130 Kansas_City,_MO,_US:216.66.77.230 Los_Angeles,_CA,_US:66.220.18.42 Miami,_FL,_US:209.51.161.58 New_York,_NY,_US:209.51.161.14 Phoenix,_AZ,_US:66.220.7.82 Seattle,_WA,_US:216.218.226.238 Toronto,_ON,_CA:216.66.38.58 Winnipeg,_MB,_CA:184.105.255.26"
tunserver_array=($tunservers)
tunserver_count=${#tunserver_array[@]}
i=1
(
echo -e "Location\tIP\tmin\tavg\tmax\tmdev"
(

In a built application, we want the application to check whether an arbitrary package has been built (composer install) into the code base.

We were originally thinking of storing a list of all installed packages (including their replace links) and that works for our test cases, but I can image it won't work for chained replacements, for instance: the requirements for package A are checked. A depends on D. The application already has B installed, which replaces C, which replaced D. As such, D is available within the system and A can be installed, but our code currently does not correctly output this, as it only stores B's replaced packages, which is C. It doesn't store C's replaced packages (D). We also need to perform this check programmatically, so there is no CLI environment. The reason we need this, is that the application allows extensions to be enabled runtime (so after the code base has been built), but it must make sure the code base has indeed been built correctly. Those extensions are also their

@MichaelGooden
MichaelGooden / app.js
Created February 20, 2015 16:31
Angular JS Skeleton
angular.module('myapp', ['myapp.services', 'myapp.controllers', 'myapp.directives'])
.config(function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
'self',
'http://example.com/api/**'
]);
})
.config(function() {
//config functions here
@MichaelGooden
MichaelGooden / gist:6520254
Last active December 22, 2015 19:29 — forked from Goram/gist:6520240
<?php
$form = new Form();
$form->setAttribute('method', 'post');
$fieldset1 = new Fieldset('user');
$fieldset1->setOptions(array(
'use_as_base_fieldset' => true
));
@MichaelGooden
MichaelGooden / route-layouts.php
Last active December 22, 2015 03:39
Set layout from route param.
<?php
public function onBootstrap(MvcEvent $e)
{
$em = $e->getApplication()->getEventManager();
$em->attach('dispatch', array($this, 'chooseLayout'));
}
public function chooseLayout(MvcEvent $e)
{
$matches = $e->getRouteMatch();
<?php
/**
*
*/
public function myTestWithNumber()
{
// Mock Service:
$mockService = $this->getMockBuilder('myService')
->disableOriginalConstructor()
@MichaelGooden
MichaelGooden / gist:6304297
Created August 22, 2013 07:53
Simple ZF2 CLI scripts.
<?php
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// Setup autoloading
require 'init_autoloader.php';