Skip to content

Instantly share code, notes, and snippets.

張旭 zx1986

Block or report user

Report or block zx1986

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sarthology / regexCheatsheet.js
Created Jan 10, 2019
A regex cheatsheet 👩🏻‍💻 (by Catherine)
View regexCheatsheet.js
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
matthewpalmer / nfs-server.yaml
Created Oct 22, 2018
Example for NFS server in Kubernetes
View nfs-server.yaml
# Note - an NFS server isn't really a Kubernetes
# concept. We're just creating it in Kubernetes
# for illustration and convenience. In practice,
# it might be run in some other system.
# Create a service to expose the NFS server
# to pods inside the cluster.
kind: Service
apiVersion: v1
alexanderadam / Ansible Disk Check
Created Sep 15, 2018 — forked from mahemoff/Ansible Disk Check
Show disk space and warn about disk full in Ansible
View Ansible Disk Check
* Shows a message while asserting like:
ok: [host] => {
"msg": "disk usage 4.2B of total 20.0GB (21.0%) (should exceed limit 90.0%)"
* Note this only looks at first mount point on current node
* Fails if disk is near-full
* Last step pushes to a push-based monitoring service, which will alert us if it doesn't get there after some time
* Need to setup a variable `disk_limit`, which is the max acceptable usage ratio, e.g. set it to 0.8 if you want to keep disks within 80% of max size
melozo / daemon.json
Created Jun 12, 2018
Example Docker daemon.json
View daemon.json
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"cluster-store": "",
"cluster-store-opts": {},
"cluster-advertise": "",
"debug": true,
matthewpalmer / pod.yaml
Last active Nov 21, 2019
Example Kubernetes pod for the multi-container sidecar design pattern
View pod.yaml
# Example YAML configuration for the sidecar pattern.
# It defines a main application container which writes
# the current date to a log file every five seconds.
# The sidecar container is nginx serving that log file.
# (In practice, your sidecar is likely to be a log collection
# container that uploads to external storage.)
# To run:
mrichman /
Last active Dec 31, 2019
Bootstrap script for setting up a new OSX machine
#!/usr/bin/env bash
# Bootstrap script for setting up a new OSX machine
# This should be idempotent so it can be run multiple times.
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
# - Twitter (app store)
ekreutz /
Created Dec 22, 2017
Ansible variable precedence (order, hierarchy)
visualskyrim / modify_ulimit.yml
Last active Dec 18, 2019
A ansible playbook to modify ulimit
View modify_ulimit.yml
- hosts: all
become: true
- name: configure system settings, file descriptors and number of threads
domain: <--your-username-->
limit_type: "{{item.limit_type}}"
limit_item: "{{item.limit_item}}"
value: "{{item.value}}"
jsoendermann /
Created Nov 22, 2017
阿里云 Aliyun OSS curl upload 上传
CONTENT_MD5=$(openssl dgst -md5 -binary "${FILEPATH}" | openssl enc -base64)
CONTENT_TYPE=$(file -ib "${FILEPATH}" |awk -F ";" '{print $1}')
DATE_VALUE="`TZ=GMT date +'%a, %d %b %Y %H:%M:%S GMT'`"
SIGNATURE=$(echo -e -n $STRING_TO_SIGN | openssl dgst -sha1 -binary -hmac $OSS_ACCESS_KEY_SECRET | openssl enc -base64)
curl -i -q -X PUT -T "${FILEPATH}" \
-H "Date: ${DATE_VALUE}" \
MoOx /
Last active Jan 3, 2020
How to keep in sync your Git repos on GitHub, GitLab & Bitbucket easily
You can’t perform that action at this time.