Skip to content

Instantly share code, notes, and snippets.

View lengerfulluse's full-sized avatar
🏠
Working from home

Wei Heng lengerfulluse

🏠
Working from home
View GitHub Profile
# 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.

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 \
@lengerfulluse
lengerfulluse / nginx_location_info.txt
Created August 9, 2018 12:30
Install Nginx on MAC
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/.
@lengerfulluse
lengerfulluse / Sublime-shortcut-cmd
Created July 30, 2018 03:58
Sublime-shortcut-cmd
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
@lengerfulluse
lengerfulluse / basic_python_regex.py
Created July 18, 2018 09:52
Simple usage of python with regex and backreference
#/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 January 3, 2018 11:48
configure ssl redirect for nginx
# 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 November 30, 2017 09:02
install pygments for jekyll on MacOs
command `sudo easy_install pygments` seems not work for me, use the following command got successfully.
sudo gem install pygments.rb
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 March 31, 2017 08:45
tensorflow install tutorial
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 February 16, 2017 02:57
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