Skip to content

Instantly share code, notes, and snippets.

Working from home

Wei Heng lengerfulluse

Working from home
View GitHub Profile
View basic_nginx_multi_hosting.conf
# For more information on configuration, see:
# * Official English Documentation:
# * Official Russian Documentation:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.

Dev&Build tools:

  sudo yum groupinstall "Development Tools"
  sudo yum install openssl openssl-devel
  sudo yum install git-core


  yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel \
View nginx_location_info.txt
Install nginx on MAC:
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
View Sublime-shortcut-cmd
ln -s /Applications/Sublime\ /usr/local/bin/subl
lengerfulluse /
Created Jul 18, 2018
Simple usage of python with regex and backreference
# sample of python regex with non-greedy(?) and back-reference(\1).
import re
pattern = re.compile(r'paymentContractId=(.*?)">\1');
for i, line in enumerate(open('vbs-charged-backfill-orders.preprocessed')):
for match in re.finditer(pattern, line):
lengerfulluse / ssl-redirect-nginx.conf
Created Jan 3, 2018
configure ssl redirect for nginx
View ssl-redirect-nginx.conf
# http part
server {
listen 80;
listen [::]:80;
root /var/www/;
index index.html index.htm;
# Make site accessible from http://localhost/
lengerfulluse / install_pygments_on_mac
Last active Nov 30, 2017
install pygments for jekyll on MacOs
View install_pygments_on_mac
command `sudo easy_install pygments` seems not work for me, use the following command got successfully.
sudo gem install pygments.rb
View set up automatic deployment with git with a vps
1. set remote git repo
2. set local git branch: git remote add tech ssh://
3. git push: git push live master
lengerfulluse / tensorflow_install_steps
Created Mar 31, 2017
tensorflow install tutorial
View tensorflow_install_steps
lengerfulluse /
Last active Feb 16, 2017
common perl command for shell
# remove end ^M character
perl -pe 's{\d+\.\d+%}{$&/100}eg'
# parse csv file, convert to tsv file.
perl -MText::ParseWords -lne'
print join "\t", map "$_",
parse_line(",",0, $_); # if you want to keep the double-quotes of the field, just use put '1' instead of 0 as the second parameter.
' infile.csv >infile.tsv
You can’t perform that action at this time.