Skip to content

Instantly share code, notes, and snippets.

View joerx's full-sized avatar
💭
I may be slow to respond.

Jörg Henning joerx

💭
I may be slow to respond.
  • Transferwise
  • Singapore
View GitHub Profile

VBox Guest Additions on Debian 9

Taken from [here][1] but in a more comprehensive format

Switch to root:

su root
@joerx
joerx / using-watch.sh
Last active September 29, 2017 02:11
Monitor EC2 instances filtered by tags and state, filter output through jq to get only specific attributes
# more concise and refreshes screen
watch "aws ec2 describe-instances --filter 'Name=tag-key,Values=Name' 'Name=tag-value,Values=$INSTANCE_NAME' 'Name=instance-state-name,Values=pending,running,shutting-down,stopping,stopped' | jq '.Reservations[].Instances[] | {state: .State.Name, instanceId: .InstanceId}'"
@joerx
joerx / minikube.sh
Last active September 6, 2017 03:07
Minikube cheatsheet
# start minikube, use embedded docker
minikube start
eval $(minikube docker-env)
# k8s dashboard
minikube dashboard
@joerx
joerx / getcert.sh
Created September 3, 2017 05:31
Fetch and display SSL cert for remote host
#!/bin/sh
HOST=$1
echo "HOST=$HOST"
openssl s_client -connect $HOST:443 -servername $HOST -showcerts </dev/null 2>/dev/null | openssl x509 -text -noout
@joerx
joerx / python-cheatsheet.md
Last active September 25, 2017 05:45
Python Cheatsheet

Python Cheatsheet

Stuff I should keep in mind but can't. No bullshit.

Install (macOS)

  • Python3: brew install python3
  • VirtualEnv: pip3 install virtualenv

Virtualenv

@joerx
joerx / smile.txt
Created December 12, 2016 00:50
Smile!
😬
@joerx
joerx / default.conf
Last active July 15, 2016 09:40
Simple nginx.conf to server PHP-FPM apps
server {
listen 80 default_server;
server_name _;
root /home/server/htdocs/projects/default;
location ~ ^/\. {
deny all;
}
@joerx
joerx / php-fpm-nginx-errorlog.md
Last active August 6, 2023 16:49
redirect php-fpm output to nginx's error log
  • php process is wrapped like this: PHP file -> php-fpm -> nginx
  • basically means disable all facilities that catch output from the script on it's way to nginx
  • standard error output will the end in Nginx's logging facility

On CentOS

  • make sure your script does not set error_log
  • edit /etc/php-fpm.conf, disable line error_log = /var/log/php-fpm/error.log
  • edit /etc/php-fpm.d/www.conf, disable line starting with php_admin_value[error_log] = ...
  • restart fpm: systemctl restart php-fpm
@joerx
joerx / index.html
Created May 10, 2016 04:18
Simple canvas drawing app
<!doctype html>
<html>
<head>
<title>Canvas Painter Demo</title>
<style>
#container {position: relative;}
#imageView {border: 1px solid #000;}
</style>
</head>
<body>
@joerx
joerx / even_numbers.go
Created May 1, 2016 04:48
Print all even numbers from 0 to 100 using binary operators only
package main
import (
"fmt"
)
func main() {
var val int
for i := 1; i <= 50; i++ {
val = i << 1