Skip to content

Instantly share code, notes, and snippets.

Vincent Lin (Sheng-Je Lin) v1nc3ntlaw

Block or report user

Report or block v1nc3ntlaw

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
v1nc3ntlaw / webapp.conf
Created Jul 9, 2017 — forked from kakipo/webapp.conf
Force Redirect HTTP to HTTPS on nginx behind ELB
View webapp.conf
# redirect http to https
set $redirect "";
if ($http_x_forwarded_proto != 'https') {
set $redirect "1";
if ($http_user_agent !~* ELB-HealthChecker) {
set $redirect "${redirect}1";
if ($http_host ~ "") {
set $redirect "${redirect}1";
v1nc3ntlaw /
Created Jun 29, 2017 — forked from kimus/
NAT and FORWARD with Ubuntu’s ufw firewall


I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

v1nc3ntlaw / heroku_nginx_301.conf
Created Sep 21, 2014
heroku-buildpack-php heroku-php-nginx -C nginx_app.conf redirect all http to https
View heroku_nginx_301.conf
# redirect all http to https with 301
if ( $http_x_forwarded_proto = http ) {
return 301 https://$host$request_uri;
View apache-mysql-restarter
threshold=80 # percent
total=$(free | grep "Mem:" | awk '{print $2}')
remaining=$(free | grep "buffers" | awk '{print $4}' | tail -n 1)
current=$(echo "scale=0;100-$remaining * 100 / $total" | bc -l)
if [ $current -gt $threshold ]
/etc/init.d/httpd stop
View passenger-standalone-nginx
Passenger Standalone with Nginx
passenger start -S /tmp/ -d
nginx config example
upstream s_dev_server {
v1nc3ntlaw / mysql-utf8mb4-barracuda
Last active Mar 24, 2017
MySQL using utf8mb4 and innodb_file_format Barracuda settings
View mysql-utf8mb4-barracuda
init_connect='SET collation_connection = utf8mb4_unicode_ci'
init_connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
character-set-client = utf8mb4
collation-server = utf8mb4_unicode_ci
innodb_file_format = Barracuda
v1nc3ntlaw /
Created Aug 20, 2012
use git post receive hook send irc notification
# An example hook script for the "post-receive" event.
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated. It is passed arguments in through
# stdin in the form
# <oldrev> <newrev> <refname>
# For example:
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
v1nc3ntlaw /
Created Mar 30, 2012
rbenv install ruby 1.9.3-p327 on Ubuntu 12.04 LTS for chef bootstrap
# rbenv setup
export RBENV_ROOT=/usr/local/rbenv
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
v1nc3ntlaw / com.coverallcrew.firewall.plist
Created Mar 24, 2012 — forked from pgib/com.coverallcrew.firewall.plist
coverallcrew firewall start-up script for mac os to forward port 80 to local nginx on 8080
View com.coverallcrew.firewall.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
v1nc3ntlaw /
Last active Apr 23, 2019
rbenv install ruby 1.9.3-p448 on Ubuntu 12.04 LTS
# Run as root
# $ bash <(curl -s
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl \
libssl-dev \
You can’t perform that action at this time.