Skip to content

Instantly share code, notes, and snippets.

View zhiguangwang's full-sized avatar

Zhiguang Wang zhiguangwang

View GitHub Profile
@zhiguangwang
zhiguangwang / README.md
Last active May 10, 2021 04:00
Extending Linux file system after resizing EBS volume

Extend partition on root volume

sudo growpart /dev/nvme0n1 1

Extend file system on root volume

ext4

@zhiguangwang
zhiguangwang / README.md
Last active May 7, 2022 06:16
Use Nomad "spread" Scheduler

Read Scheduler Config

curl -sS --header "X-Nomad-Token: $NOMAD_TOKEN" "$NOMAD_ADDR/v1/operator/scheduler/configuration" | jq .

Sample Output

{
@zhiguangwang
zhiguangwang / README.md
Created August 16, 2020 06:08
Removing node from Elasticsearch cluster
POST /_cluster/voting_config_exclusions?node_names=odfe-node-0

GET /_cluster/state?filter_path=metadata.cluster_coordination.voting_config_exclusions

DELETE /_cluster/voting_config_exclusions

Above works with Elasticsearch 7.8, see

@zhiguangwang
zhiguangwang / README.md
Created March 15, 2020 08:24
Monitor CPU frequency on Linux

watch -n1 grep MHz /proc/cpuinfo

@zhiguangwang
zhiguangwang / README.md
Created September 12, 2019 06:11
Show the environment variables of a running process in Linux
sudo cat /proc/<pid>/environ | tr '\0' '\n'
@zhiguangwang
zhiguangwang / README.md
Created August 29, 2019 08:44
Force Nomad Server to GC
@zhiguangwang
zhiguangwang / README.md
Last active August 29, 2019 02:52
Force-leave Consul nodes in "failed" state
@zhiguangwang
zhiguangwang / docker-sslocal.sh
Created August 4, 2019 07:39
Configure the Docker daemon to use ss-local as HTTP/HTTPS proxy.
#!/bin/bash
set -e
function print_usage {
echo
echo "Usage: docker-sslocal.sh [OPTIONS]"
echo
echo "This script is to configure the Docker daemon to use ss-local as HTTP/HTTPS proxy."
echo
@zhiguangwang
zhiguangwang / README.md
Last active May 5, 2019 10:01
bash curl loop
curl-loop() { while true; do echo "$(date +%Y-%m-%dT%H:%M:%S%z) $(curl --silent --show-error ${1})"; sleep ${2:-0.5}; done }

Usage

curl-loop <url> [interval]
@zhiguangwang
zhiguangwang / README.md
Last active December 22, 2020 02:15
SSH Tunnelling
ssh-tunnel() { nohup ssh -o ServerAliveInterval=15 -f -N -L ${1}:${2} ${3} > /dev/null 2>&1; }

Usage

ssh-tunnel <local-port> <remote-host>:<remote-port> <bastion>