Skip to content

Instantly share code, notes, and snippets.

@zhangll
zhangll / nginxproxy.md
Created November 13, 2017 10:26 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@zhangll
zhangll / net_speeder_install.sh
Last active March 27, 2017 04:46
net_speeder_install
#!/bin/sh
# Set Linux PATH Environment Variables
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check If You Are Root
if [ $(id -u) != "0" ]; then
clear
echo -e "\033[31m Error: You must be root to run this script! \033[0m"
# Install
pip install virtualenv
pip install virtualenvwrapper
# .bashrc config
export WORKON_HOME=$HOME/.virtualenvs
@zhangll
zhangll / Compare
Created October 22, 2013 13:02
Compare Special String Not Valid!
package snippet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.Test;
/**
* get random symbol
*/
function getSameSymbol(theSymbol,maxLength){
var symbols = []
for (var i = 0; i < Math.floor(Math.random()*maxLength); i++) {
symbols.push(theSymbol);
}
return symbols.join('')
}