Skip to content

Instantly share code, notes, and snippets.

@heartshare
heartshare / ip_blacklist.lua
Last active August 26, 2015 05:50 — forked from chrisboulton/ip_blacklist.lua
Redis based IP blacklist for Nginx (LUA)
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
#!/bin/sh
KEY="$HOME/.ssh/id_dsa.pub"
if [ ! -f ~/.ssh/id_dsa.pub ];then
echo "private key not found at $KEY"
echo "* please create it with "ssh-keygen -t dsa" *"
echo "* to login to the remote host without a password, don't give the key you create with ssh-keygen a password! *"
exit
fi

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
#!/bin/bash
CACHE_PATH="/var/www/cache"
if (( $# < 1 ))
then
sudo rm -rf "$CACHE_PATH"/*
else
curl -H "X-Purge: 1" -g -s -v "$1"
fi

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users
MODULES=(
plugins/ftAttractionPlugin
plugins/ftCalendarPlugin
plugins/ftCommonPlugin
plugins/ftContentPlugin
plugins/ftFormPlugin
plugins/ftHotelRestaurantPlugin
plugins/ftListingPlugin
plugins/ftMasterCatalogPlugin
plugins/ftNewsTipsPlugin
array=( bla ble bli blo blu )
for item in ${array[@]}; do
echo $item
done
settings = {
delay = 1,
maxProcesses = 3,
logfile = "/var/log/lsyncd.log",
}
targetlist = {
"10.0.1.24:/var/www/thomasjstein.com",
"10.0.1.26:/var/www/thomasjstein.com"
}
#!/bin/bash
if [ $# -ne 2 ]
then
echo "[ERROR] Please input the destnation hostname or ipaddress and a sync directory."
exit 1;
fi
ssh-keygen
cd /root/.ssh/