Skip to content

Instantly share code, notes, and snippets.

<?php
class Command {
public $param1;
public $param2;
public $param3=2;
public function getParam3(){
return $this->param3;
}
}
@micoli
micoli / gist:3e623a7e63f41100a4d7c33cb7d31118
Created June 7, 2019 13:10
Minimalist Makefile to help local php DX
default: help
help:
@echo "Usage:"
@echo " make [command]"
@echo
@echo "Available commands:"
@grep -v '^_' Makefile | grep '^[^#[:space:]].*:' | grep -v '^default' | sed 's/:\(.*\)//' | xargs -n 1 echo ' -'
@echo
kubecl get secret kaniko-secret -o json | jq -r '.data."config.json"' | base64 -D | jq -r '.auths."registry.gitlab.com".auth'| base64 -D
networksetup -setdnsservers Wi-Fi \
8.8.8.8 \
8.8.4.4 \
$(kubectl get svc --namespace kube-system kube-dns -o json | jq -r ".spec.clusterIP")
kubectl get pods -o json | jq -r '.items[].status.containerStatuses[].state.running.startedAt | fromdate | tostring + ""' | sort -r | head -n 1 | xargs date -r
<: &backend-forward
name: backend-http
type: kubernetes-remote
values:
context: dev-microk8s
namespace: default
labels:
app: v1-app-webserver # pod deployment
hostname: backend-http
ports:
#!/bin/bash
iptables -t filter -A FORWARD -o vmbr2 -j ACCEPT
iptables -t filter -A FORWARD -i vmbr2 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o vmbr2 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp -d external.public.ip --dport 5000 -i vmbr0 -j DNAT --to-destination 10.8.1.2:5000
#!/bin/bash
defaults write -g InitialKeyRepeat -int 15 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 2 # normal minimum is 2 (30 ms)
print "<pre>";
print_r(array_map(function($v){
return array_filter($v,function($v){
return in_array($v,["title","created_at","updated_at","source_branch","web_url"]);
},ARRAY_FILTER_USE_KEY);
},$mergeRequests));
die();
EDITOR=true git rebase --autosquash --autostash -i origin/master