Skip to content

Instantly share code, notes, and snippets.

View pjdevries's full-sized avatar

Pieter-Jan de Vries pjdevries

View GitHub Profile
@pjdevries
pjdevries / tunnel.sh
Created December 12, 2022 12:46
Create ssh tunnel in shell script
remoteHost=xxx.xxx.xxx.xxx
remoteUser=uuuuuuuu
remotePort=XXXX
localPort=YYYY
function cleanup() {
ssh -S my-ctrl-socket -O exit ${remoteUser}@${remoteHost}
}
trap cleanup EXIT SIGHUP SIGINT SIGQUIT SIGABRT
@pjdevries
pjdevries / DynamicMethodTrait.php
Last active March 19, 2022 10:44
Dynamic object methods (closure object binding)
trait DynamicMethod
{
private array $dynamicMethods = [];
public function addMethod(string $methodName, callable $methodCallable): void
{
$this->dynamicMethods[$methodName] = Closure::bind($methodCallable, $this, get_class());
}
public function __call(string $methodName, ...$args)

Keybase proof

I hereby claim:

  • I am pjdevries on github.
  • I am pjdevries (https://keybase.io/pjdevries) on keybase.
  • I have a public key whose fingerprint is 02CE 9E56 CAA8 1F16 7BA1 7BEF 2A6D 6F31 B5B6 AF67

To claim this, I am signing this object:

@pjdevries
pjdevries / Form2Content Image Gallery with YOOtheme's UIkit
Last active August 29, 2015 14:24
Form2Content Image Gallery with YOOtheme's UIkit