Skip to content

Instantly share code, notes, and snippets.

@robinwl
robinwl / sshuttle.conf
Created October 4, 2016 20:37
sshuttle upstart
description "sshuttle daemon"
author "Robin <robin@naas.io>"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/usr/sbin/sshuttle
env ARGS="-NH --syslog"
env TARGET="user@remotehost:port"
@robinwl
robinwl / Vagrantfile
Created December 9, 2015 15:36
Vagrant Ubuntu Trusty
# -*- mode: ruby -*-
# vi: set ft=ruby :
$fixnotty = <<SCRIPT
sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile
SCRIPT
$mirrors = <<SCRIPT
export DEBIAN_FRONTEND=noninteractive
cat > /etc/apt/sources.list <<- EOM
@robinwl
robinwl / mirror_test.sh
Created November 27, 2015 16:40 — forked from lox/mirror_test.sh
A bash script to select the fastest ubuntu apt geo-mirror
#!/bin/bash -e
# mirror_test.sh
# benchmarks closest ubuntu mirrors and outputs them in speed order
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/lox/9152137/raw/mirror_test.sh)"
RELEASE=$(lsb_release -c -s 2>/dev/null || echo 14.04)
MIRRORS=$(curl -s http://mirrors.ubuntu.com/mirrors.txt)
TESTFILE="dists/$RELEASE/main/binary-amd64/Packages.bz2"
TIMEOUT=1
@robinwl
robinwl / carbon-relay
Created June 18, 2015 17:23
carbon-relay init.d script
#! /bin/sh
### BEGIN INIT INFO
# Provides: carbon-relay
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Graphite Carbon relay daemon
# Description: relay pickled data to multiple backend for Graphite
### END INIT INFO
@robinwl
robinwl / packages.list
Last active August 29, 2015 14:22
cloudix vagrant packages
acl
acpid
alsa-lib
at
attr
audit
audit-libs
authconfig
autogen-libopts
aws-cfn-bootstrap
@robinwl
robinwl / packages 2015-05-30
Created May 31, 2015 00:36
cloudix docker-image packages
acl
at
attr
audit-libs
authconfig
basesystem
bash
bc
bind-libs
bind-utils
@robinwl
robinwl / generate_index.cron
Last active January 19, 2021 20:04
cowsay webserver index
*/5 * * * * www-data /usr/local/bin/generate_index.sh
@robinwl
robinwl / smartctl_hddtemp_
Created May 2, 2015 17:22
HDD temperature in Munin with smartmontools
#!/bin/bash
#
# Configuration
# -------------
# [smartctl_hddtemp_*]
# user root
# group root
# env.attribute 194 # Id of SMART attribute, you probably want to use 194. http://en.wikipedia.org/wiki/S.M.A.R.T.#Known_ATA_S.M.A.R.T._attributes
# env.warning 50 # The environment variables "warning" and "critical" sets the temperature from which Munin starts to warn.
# env.critical 55
@robinwl
robinwl / cache_params
Created May 1, 2015 07:41
nginx as TLS terminator/reverse cache proxy for Apache & ownCloud 8.x
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment; # Defines conditions under which the response will not be taken from a cache. If at least one value of the string parameters is not empty and is not equal to “0” then the response will not be taken from the cache.
proxy_cache_bypass $http_pragma $http_authorization;
proxy_cache_key $scheme$proxy_host$request_uri; # Defines a key for caching.
proxy_cache_lock on; # When enabled, only one request at a time will be allowed to populate a new cache element identified according to the proxy_cache_key directive by passing a request to a proxied server.
proxy_cache_methods GET HEAD; # If the client request method is listed in this directive then the response will be cached. “GET” and “HEAD” methods are always added to the list, though it is recommended to specify them explicitly.
proxy_cache_min_uses 1; # Sets the number of requests after which the response will be cached.
@robinwl
robinwl / gist:6e0eba6e4bc8dbf04c4c
Last active August 29, 2015 14:20
linux-dash nginx
server {
listen 80 default_server;
root /var/www/html/;
index index.html index.htm;
server_name _;
location / {
try_files $uri $uri/ =404;
}