View serving.py
import time
from werkzeug.serving import BaseRequestHandler
class MyFancyRequestHandler(BaseRequestHandler):
"""Extend werkzeug request handler to suit our needs."""
def handle(self):
self.fancyStarted = time.time()
rv = super(MyFancyRequestHandler, self).handle()
return rv
View timeout.sh
#
# Mac OS-X does not come with the delightfully useful `timeout` program. Thankfully a rough BASH equivalent can be achieved with only 2 perl statements.
#
# Originally found on SO: http://stackoverflow.com/questions/601543/command-line-command-to-auto-kill-a-command-after-a-certain-amount-of-time
#
function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
## Example usage:
#
View camel_case_to_snake_case.py
#!/usr/bin/env python
"""
Convert camel-case to snake-case in python.
e.g.: CamelCase -> snake_case
Relevant StackOverflow question: http://stackoverflow.com/a/1176023/293064
"""
View chromium_socks5_sslnovalidate.md

First, download and install chromium (because running a browser with SSL verification turned off is insecure -- only use this browser for accessing mesos).

Window 1:

ssh -D 9999 <hostname>

Window 2:

View cf.sh
#!/usr/bin/env bash
##
# @author Jay Taylor [@jtaylor]
# @date 2013-08-15
#
# @description CloudFlare management script.
#
# Path ENV VAR override.
View aws-network-troubleshooting.md

Check a route path:

Start a container in --net=routed mode:

sudo docker run --rm -it --net=routed --ip-address=10.241.9.10 centos

vethrb31af40 = container network interface obtained from ip route output.

View mesos-20151029.md

tail -F /var/log/mesos/*

==> /var/log/mesos/mesos-master.INFO <==
I1029 21:01:33.413650 23704 replica.cpp:642] Replica in EMPTY status received a broadcasted recover request from (185)@172.31.8.161:5050
I1029 21:01:33.604188 23709 replica.cpp:642] Replica in EMPTY status received a broadcasted recover request from (25)@172.31.32.172:5050
I1029 21:01:33.604387 23709 recover.cpp:195] Received a recover response from a replica in EMPTY status
I1029 21:01:33.613934 23708 recover.cpp:195] Received a recover response from a replica in EMPTY status
I1029 21:01:34.297235 23708 replica.cpp:642] Replica in EMPTY status received a broadcasted recover request from (187)@172.31.8.161:5050
I1029 21:01:34.404985 23709 replica.cpp:642] Replica in EMPTY status received a broadcasted recover request from (27)@172.31.32.172:5050
I1029 21:01:34.405491 23709 recover.cpp:195] Received a recover response from a replica in EMPTY status
View EnvHacker.scala
trait EnvHacker {
/**
* Portable method for setting env vars on both *nix and Windows.
* @see http://stackoverflow.com/a/7201825/293064
*/
def setEnv(newEnv: Map[String, String]): Unit = {
try {
val processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment")
val theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment")
theEnvironmentField.setAccessible(true)
View react-unexpected-use-of-location.md
React: Unexpected use of 'location';

Solution: Use window.location instead of bare location.

View etc-init-splunkforwarder.conf
# SplunkStorm Forwarder
description "SplunkStorm Forwarder"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]