Skip to content

Instantly share code, notes, and snippets.

@zhuwei05
zhuwei05 / deployment.yml
Created January 4, 2019 14:13 — forked from troyharvey/deployment.yml
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@zhuwei05
zhuwei05 / gist:e530c3cf966a42e81768a019bb586b74
Created October 10, 2017 07:22 — forked from ricbra/gist:39ad51dbaa2be90e56fd
Install OpenCV on Ubuntu Trusty Vagrant box
sudo apt-add-repository ppa:jon-severinsson/ffmpeg
sudo apt-get update
sudo apt-get upgrade -y
version="$(wget -q -O - http://sourceforge.net/projects/opencvlibrary/files/opencv-unix | egrep -m1 -o '\"[0-9](\.[0-9]+)+' | cut -c2-)"
echo "Installing OpenCV" $version
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
@zhuwei05
zhuwei05 / gist:c189e7d7162bcea73d68c9614106b695
Created July 17, 2017 08:48 — forked from mdbecker/gist:1309633
multiprocess && gevent example
from multiprocessing import Pool as MPool
from time import sleep
import datetime
import multiprocessing
import random
def time_request():
from gevent import monkey; monkey.patch_socket
from jsonrequester import JsonRequester
@zhuwei05
zhuwei05 / ioslocaleidentifiers.csv
Created March 30, 2017 06:47 — forked from jacobbubu/ioslocaleidentifiers.csv
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@zhuwei05
zhuwei05 / retry.py
Created November 14, 2016 06:56 — forked from curzona/retry.py
retry utility for Python
import time
import inspect
import types
def _assert(func):
if not func():
if isinstance(func, types.FunctionType):
raise AssertionError(inspect.getsource(func).strip())
else:
raise AssertionError()
@zhuwei05
zhuwei05 / gist:ab203c0032980c8f9d31cb992b8ac891
Created July 22, 2016 08:01 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
atom sync settings
## Name of the riak node
-name riak@127.0.0.1
## Cookie for distributed erlang. All nodes in the same cluster
## should use the same cookie or they will not be able to communicate.
-setcookie riak
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
## (Disabled by default..use with caution!)
##-heart