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 September 18, 2025 08:30
Installing and running shadowsocks on Ubuntu Server

Installing and running shadowsocks on Ubuntu Server

16.10 yakkety and above

  1. Install the the shadowsocks-libev package from apt repository.

     sudo apt update
     sudo apt install shadowsocks-libev
    
  2. Save ss.json as /etc/shadowsocks-libev/config.json.

@zhiguangwang
zhiguangwang / openssl.md
Last active May 17, 2025 08:10
Common OpenSSL Commands with Keys and Certificates

Common OpenSSL Commands with Keys and Certificates

Generate RSA private key (2048 bit)

openssl genrsa -out private.pem 2048

Generate a Certificate Signing Request (CSR)

openssl req -sha256 -new -key private.pem -out csr.pem
@zhiguangwang
zhiguangwang / README.md
Last active April 7, 2025 20:59
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
Last active February 26, 2025 08:23
Disable and Enable kdc on Mac OS X

If you don't like or need the kdc process on Mac OS X, which opens TCP port 88 to the world, you can disable it with launchctl.

Disable:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist

Enable:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist
@zhiguangwang
zhiguangwang / README.md
Created August 26, 2018 08:24
Remove / Uninstall packages marked ‘rc’ on Debian / Ubuntu.

Remove / Uninstall packages marked ‘rc’ on Debian / Ubuntu.

While checking the status of packages using dpkg, it is possible to see a ‘rc’ state for some unused packages, this corresponds to:

  • r: the package was marked for removal
  • c: the configuration files are currently present in the system

In other words: the package is not completely removed (config files are still present), but not installed anymore (and obviously not used).

To see a list of packages marked as ‘rc’:

@zhiguangwang
zhiguangwang / README.md
Last active September 3, 2024 07:23
Building Unreal Engine Game Client and Dedicated Server on Linux.

Building Unreal Engine Game Client and Dedicated Server on Linux

Because the build tools of UE4 works across platforms (Windows, Mac OS, Linux), steps in this article can be applied to Mac OS and Windows as well.

On Windows, You need to replace RunUAT.sh with RunUAT.bat though.

Prerequisites

First, get Unreal Engine 4 sourcecode and export the following environment variables:

@zhiguangwang
zhiguangwang / README.md
Last active January 31, 2024 17:35 — forked from ygmpkk/sslocal.service
Shadowsocks Systemd Service

Copy ssserver.service to under /lib/systemd/system/ and run:

sudo systemctl enable ssserver
sudo systemctl start ssserver

sudo systemctl status ssserver

@zhiguangwang
zhiguangwang / README.md
Last active January 17, 2024 14:43
Rename top-level folder while creating a tar.gz file.
tar czfv NEW_NAME.tar.gz OLD_NAME --transform s/OLD_NAME/NEW_NAME/

Note: this only works with GNU Tar.

Example

we want to tar /opt/zlib/1.2.11 into zlib-1.2.11.tar.gz, and we want the top-level folder inside that tar.gz file to be zlib-1.2.11, not 1.2.11:

@zhiguangwang
zhiguangwang / codedeploy.md
Last active August 28, 2022 07:05
Deal with CodeDeploy ApplicationStop failure with AWS CLI.

Use the --ignore-application-stop-failures option with the AWS CLI tool while doing the deployment:

aws deploy create-deployment --application-name APPLICATION --deployment-group-name GROUP --ignore-application-stop-failures --s3-location bundleType=tar,bucket=BUCKET,key=KEY --description "Ignore ApplicationStop failures due to broken script"
@zhiguangwang
zhiguangwang / install-salt-minion.sh
Last active May 31, 2022 12:56
Install salt-minion on Ubuntu
#!/bin/bash
set -e
SALT_VERSION='3002'
if [ -z "$1" ]; then
echo 'Please run this script with argument <salt-master address>'
exit 1
fi