Skip to content

Instantly share code, notes, and snippets.


Ben Zhang ben-z

View GitHub Profile
ben-z /
Created June 10, 2021 08:18
Print system info
#SBATCH --time=0-00:01:00 # time (DD-HH:MM:ss)
# Print system info (useful on shared HPCs)
# The example header is for running on Compute Canada
echo "------ Gathering System Info"
set -x
ben-z /
Last active June 5, 2021 22:50
MAC Address Generator (Valid unicast locally administered address)
# MAC Address Generator
# Generates valid unicast locally administered addresses by
# setting bit 2 of the first byte and clearing bit 1 of the first byte.
# Documentation:
# Script URL:
function prettyprintmac {
echo $1 | sed -e 's/../&:/g' -e 's/:$//'
ben-z /
Last active August 2, 2022 12:43
K3s Installation Notes

K3s Installation Notes (for running Gitlab Runner)

Install k3s master and expose api:

curl -sfL | INSTALL_K3S_EXEC="server --write-kubeconfig-mode 644 --bind-address" sh -

The --write-kubeconfig-mode 644 gives /etc/rancher/k3s/k3s.yaml group and world read permissions so that we can run kubectl without sudo. The INSTALL_K3S_EXEC argument can be modified at /etc/systemd/system/

ben-z /
Created April 24, 2015 00:57
Keybase proof

Keybase proof

I hereby claim:

  • I am ben-z on github.
  • I am benzhang ( on keybase.
  • I have a public key whose fingerprint is C1E2 F7E1 7F23 A2FE C8C7 A7A7 9D94 E011 FF98 B78F

To claim this, I am signing this object:

ben-z / css-login.html
Last active August 29, 2015 14:18
Simple Log In Form with css. Preview on Codepen:
View css-login.html
<!DOCTYPE html>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="author" content="">
<meta name="license" content="ISC">
<title>Log In</title>
<link rel="stylesheet" href="main.css">
ben-z / HHVMErrorHandler.php
Last active August 7, 2016 15:07
HHVM Error Handling - Error display in browser
View HHVMErrorHandler.php
* Custom error handling for hhvm
* Implemented in EPSInventory-API( on Jan 5, 2015
* Referenced from:
// Usage: Call `set_error_handler(error_handler);` at the top of any php or hh file running on hhvm