Skip to content

Instantly share code, notes, and snippets.

View mrtimp's full-sized avatar

Tim Philips mrtimp

View GitHub Profile
@mrtimp
mrtimp / dc.json
Last active January 28, 2019 00:09
{
"license" : "private",
"checkver": {
"github": "https://github.com/sudomabider/decompose"
},
"autoupdate": {
"url": "https://github.com/sudomabider/decompose/releases/download/v$version/dc.exe"
},
"description" : "Docker Compose helper",
"bin" : "dc.exe",
@mrtimp
mrtimp / 0_reuse_code.js
Created June 8, 2014 09:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mrtimp
mrtimp / gist:6987519
Last active December 31, 2015 03:20
Cisco IOS IPsec/L2TP VPN
!
aaa new-model
!
!
aaa authentication login VPN local
aaa authorization network VPN local
!
!
vpdn enable
!
@mrtimp
mrtimp / gist:5763477
Created June 12, 2013 07:38
Extract a clients SSL certificate
<?php
$options = array(
'ssl'=>array(
'capture_peer_cert' => true
)
);
// create our stream context requiring the peers certificate to be returned
$context = stream_context_create($options);
@mrtimp
mrtimp / gist:5712156
Created June 5, 2013 07:20
Auto scale the yAxis with Flot and the selectable plugin
$("#placeholder").bind("plotselected", function (event, ranges) {
var ymin, ymax;
var plotdata = plot.getData();
$.each(plotdata, function (e, val) {
$.each(val.data, function (e1, val1) {
if ((val1[0] >= ranges.xaxis.from) && (val1[0] <= ranges.xaxis.to)) {
if (ymax == null || val1[1] > ymax) ymax = val1[1];
if (ymin == null || val1[1] < ymin) ymin = val1[1];
}
@mrtimp
mrtimp / reflectionhelper.php
Created June 3, 2013 08:34
Reflection helper for exposing a calling static and non static methods with (or without) arguments.
/**
* Reflection helper to expose a method as public (for unit testing)
* and call call the method with (or without) arguments. There is
* dynamic support for static methods
*
* <code>
*
* $r = new ReflectionHelper('MyClass', 'myMethod');
* $r->setPublic()->invoke("arg1", "arg2");
*
@mrtimp
mrtimp / gist:5487745
Last active December 16, 2015 19:49
Implementing PHP style magic class methods (i.e. __call) in Python
class MyClass:
def _test(self, *args):
print "This is a dynamic method"
return
def __getattr__(self, name, *args):
if name == 'myFunction':
def function (*args):
return self._test(*args)