Skip to content

Instantly share code, notes, and snippets.

View tarrex's full-sized avatar
:octocat:
★ PRO

Tarrex tarrex

:octocat:
★ PRO
View GitHub Profile
/**
* Shows how to restrict access using the HTTP Basic schema.
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication
* @see https://tools.ietf.org/html/rfc7617
*
* A user-id containing a colon (":") character is invalid, as the
* first colon in a user-pass string separates user and password.
*/
const BASIC_USER = 'admin';
const BASIC_PASS = 'passwd';
export NVM_DIR="$XDG_DATA_HOME/nvm"
install_nvm() {
[[ -d $NVM_DIR ]] || command mkdir -p $NVM_DIR
if [[ ! -f $NVM_DIR/nvm.sh ]]; then
echo "$NVM_DIR/nvm.sh doesn't exists."
echo "Downloading nvm.sh from github to $NVM_DIR/nvm.sh ..."
echo `curl --connect-timeout 5 --compressed --create-dirs --progress-bar -fLo \
$NVM_DIR/nvm.sh https://raw.githubusercontent.com/nvm-sh/nvm/master/nvm.sh`
fi
wget https://openresty.org/download/ngx_openresty-1.9.3.1.tar.gz
tar zxvf ngx_openresty-1.9.3.1.tar.gz
cd ngx_openresty-1.9.3.1
yum install postgresql-devel # If you use '--with-http_postgres_module' option.
./configure --prefix=/opt/openresty \
--with-luajit \
--with-pcre-jit \
--with-ipv6 \
--without-http_redis2_module \
wget http://www.memcached.org/files/memcached-1.4.24.tar.gz
tar zxvf memcached-1.4.24.tar.gz
cd memcached-1.4.24
yum install libevent-devel
./configure --prefix=/usr/share/memcached
make
#make test
make install
cd .. && rm -rf memcached-1.4.24
wget http://download.redis.io/releases/redis-3.0.3.tar.gz
tar zxvf redis-3.0.3.tar.gz
cd redis-3.0.3
make PREFIX=/usr/share/redis
# If you want to run 'make test', you should install tcl before.
#yum install tcl -y
#make test
make install PREFIX=/usr/share/redis
wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz
tar zxvf LuaJIT-2.0.4.tar.gz
cd LuaJIT-2.0.4
make PREFIX=/usr/share/luajit2
make install PREFIX=/usr/share/luajit2
#!/usr/bin/env bash
# centos 7
# nginx-1.9.3
yum update -y
yum install -y epel-release
yum update -y
yum group install -y "Development Tools"
yum install -y pcre pcre-devel \
@tarrex
tarrex / secret_key_generator.py
Last active August 29, 2015 14:22
How to generate a good secret key with python
# generate a good secret key with python
# http://flask.pocoo.org/docs/0.10/quickstart
import os
os.urandom(24).encode('hex')