Skip to content

Instantly share code, notes, and snippets.

View lowerpower's full-sized avatar

Mike Johnson lowerpower

View GitHub Profile
@tolitius
tolitius / nginx.conf
Last active June 24, 2023 10:03
openresty (nginx + lua): redis connection pooling
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
init_worker_by_lua_block {
redis = require("resty.redis")
}
server {
@alex-roman
alex-roman / openresty-ubuntu-install.sh
Last active February 28, 2023 14:19
Easy install openresty (used and tested on Ubuntu 14.04, 15.10 and 16.04)
#!/bin/bash
apt-get -y update
apt-get -y install nginx-extras build-essential libpcre3-dev libssl-dev libgeoip-dev libpq-dev libxslt1-dev libgd2-xpm-dev
wget -c https://openresty.org/download/openresty-1.13.6.2.tar.gz
tar zxvf openresty-1.13.6.2.tar.gz
cd openresty-1.13.6.2
./configure \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
@arkival
arkival / intel-edison-cmdline.md
Last active March 21, 2018 00:31
C/C++ cross compilation from the command line for the Intel Edison

C/C++ cross compilation from the command line for the Intel Edison

It is not necessary to use the Eclipse environment in order to compile code for the Intel Edison. Command line compilation is possible on all platforms and is relatively straightforward. For linux and OS/X the simplest method is to download the SDK for the respective platform and setup as described below. Although Intel lists SDKs for both 32 and 64 bit Windows, I find it simpler to setup command line compilation from the integrated IOT platform installation.

All three platforms use the GNU compiler tools (gcc, g++, and friends) and the main differences really come down to differences in the command shell usage. Consequently, the procedures have the following common elements.

  1. Install the cross compilation tool chain and library file-system.
  2. Setup the path so that the operating system can find the compilers and other utilities.
  3. Setup environment variables to simplify the command line and tell the compilers where to find librari
@Apsu
Apsu / failover.sh
Last active February 12, 2024 07:08
An example failover script for dual WAN, using a ping healthcheck and managing default routes appropriately
#!/bin/bash
# Set defaults if not provided by environment
CHECK_DELAY=${CHECK_DELAY:-5}
CHECK_IP=${CHECK_IP:-8.8.8.8}
PRIMARY_IF=${PRIMARY_IF:-eth0}
PRIMARY_GW=${PRIMARY_GW:-1.2.3.4}
BACKUP_IF=${BACKUP_IF:-eth1}
BACKUP_GW=${BACKUP_GW:-2.3.4.5}