Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Wei Heng lengerfulluse

🏠
Working from home
Block or report user

Report or block lengerfulluse

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
View basic_nginx_multi_hosting.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
View amazon-ec2-basic-configuration.md

Dev&Build tools:

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

Dependencies:

  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\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
@lengerfulluse
lengerfulluse / basic_python_regex.py
Created Jul 18, 2018
Simple usage of python with regex and backreference
View basic_python_regex.py
#/bin/python
# 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):
print match.group(1)
@lengerfulluse
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/hengwei.me/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name hengwei.me www.hengwei.me;
@lengerfulluse
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
https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps
1. set remote git repo
2. set local git branch: git remote add tech ssh://hengwei@hengwei.me:~/repos/t.hengwei.me.git
3. git push: git push live master
@lengerfulluse
lengerfulluse / tensorflow_install_steps
Created Mar 31, 2017
tensorflow install tutorial
View tensorflow_install_steps
http://www.liuxiao.org/2017/02/tensorflow-mac-os-%E4%B8%8A-tensorflow-%E5%AE%89%E8%A3%85%EF%BC%88%E6%94%AF%E6%8C%81-cuda%EF%BC%89/
@lengerfulluse
lengerfulluse / common_used_perl_command.sh
Last active Feb 16, 2017
common perl command for shell
View common_used_perl_command.sh
# 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.