ssh -p <ssh-port> -c <cipher_aes256-cb> -L 8888:<db-host>:<db-port_3306> <user>@<remote-host>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# extract a circle from the image: translate to the middle of the image and define the radius to cut | |
convert IMG-TRM-1916-1038.jpg -alpha on -background none \( +clone -channel a -evaluate multiply 0 +channel -fill white -draw "translate 1500,1000 circle 0,0 0,150" \) -compose DstIn -composite -trim out.png | |
# convert a svg to png with resize the SVG to desired size | |
convert -background none -density 1536 -resize 4092x4092 roodwit.svg roodwitx4092_1536.png | |
# rounded rectangle crop | |
convert <image>.webp +repage -alpha on -background none \( +clone -channel a -evaluate multiply 0 +channel -fill white -draw "translate 225,225 roundrectangle 0,0 571,555 115,115" \) -compose DstIn -composite -trim out.webp |
We create the next request handler function via app.getRequestHandler()
. This returns a standard express handler, so we use it like expressApp.get('*', middlewareA(), middlewareB(), nextApp.getRequestHandler())
.
When the handler is invoked:
- Server#handleRequest (next-server/server/lib/next-server.js)
- Parses URL + query string if not already done
- Server#run
- Searches for matching route
REST API response format based on some of the best practices
# Resize the file system in UI, under VM -> Hardware -> Click on the disk to resize, click "Resize disk" button
# Confirm increase in disk space (1TB in my case)
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 1T 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 1T 0 part
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get number of running pods | |
kubectl get -A pods --field-selector=status.phase=Running --output json | jq -j '.items | length' | |
# get number of NOT running pods | |
kubectl get -A pods --field-selector=status.phase!=Running --output json | jq -j '.items | length' | |
# find out why a pod is in pending | |
describe pod -n <namespace> <pod-name> | |
# get a node max number of pods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed 's/,/\t/g' test.txt > output.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# | |
# Run parallel commands and fail if any of them fails. | |
# | |
set -eu | |
pids=() | |
for x in 1 2 3; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
server, but for some reason omit a client connecting to it. I added an | |
example at the bottom. | |
Save the following server in example.js: | |
*/ | |
var net = require('net'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://serverfault.com/questions/843296/how-to-expose-the-docker-api-over-tcp | |
ncat -lknvp 2375 -c "ncat -U /var/run/docker.sock" |
NewerOlder