View omg.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ps -o rss,command | grep ./omg | grep -v grep | |
488 ./omg | |
$ ps -o rss,command | grep ./omg | grep -v grep | |
10268 ./omg |
View gist:9961145
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'uri' | |
require 'json' | |
class ProperHTTP | |
def self.get(uri) | |
handle_response Net::HTTP.get_response(URI.parse(uri)) | |
end | |
def self.post(uri, payload) |
View gist:d2a3fd24ef6a605fc782
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install maven | |
The following extra packages will be installed: | |
ant ant-optional aspectj bsh fop java-wrappers junit junit4 libaether-java libaopalliance-java libapache-pom-java libasm3-java | |
libaspectj-java libasync-http-client-java libatinject-jsr330-api-java libavalon-framework-java libbatik-java libbsf-java libbsh-java | |
libcdi-api-java libcglib-java libclassworlds-java libcommons-beanutils-java libcommons-cli-java libcommons-codec-java | |
libcommons-collections3-java libcommons-configuration-java libcommons-digester-java libcommons-httpclient-java libcommons-io-java | |
libcommons-jexl2-java libcommons-jxpath-java libcommons-lang-java libcommons-logging-java libcommons-net2-java libcommons-parent-java | |
libcommons-vfs-java libdom4j-java libdoxia-java libeasymock-java libfop-java libganymed-ssh2-java libgeronimo-interceptor-3.0-spec-java | |
libgeronimo-jpa-2.0-spec-java libgeronimo-osgi-support-java libguava-java libguice-java libhamcrest-java libhttpclient-java | |
libhttpcore-java libitext1-ja |
View gist:7ebd15c7e2e7469ce0e1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TOTAL=$(sudo btrfs filesystem show /dev/mapper/lvroot-u | grep -oP '(?<=size )\d+\.\d+') | |
USED=$(sudo btrfs filesystem show /dev/mapper/lvroot-u | grep -oP '(?<=used )\d+\.\d+' | head -n1) | |
ALLOCATED=$(sudo btrfs filesystem show /dev/mapper/lvroot-u | grep -oP '(?<=used )\d+\.\d+' | tail -n1) | |
FREE=$(echo "$TOTAL - $USED" | bc) | |
echo -e -n "system.btrfs.total:$TOTAL|g" > /dev/udp/127.0.0.1/8125 | |
echo -e -n "system.btrfs.used:$USED|g" > /dev/udp/127.0.0.1/8125 | |
echo -e -n "system.btrfs.allocated:$USED|g" > /dev/udp/127.0.0.1/8125 |
View resiliency.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z $1 ]]; then | |
echo -e "\x1b[31mMust supply src + dest port" | |
exit 1 | |
fi | |
echo -e "\x1b[32mForwarded port $2 --> $1\x1b[33m" | |
sudo iptables -t nat -I OUTPUT -p tcp -o lo --dport $2 -j REDIRECT --to-ports $1 |
View gist:96326faaf94fc3051d0b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_section_a_resilient_to_data_store_b_being_down | |
Toxiproxy[:data_store_b].down do | |
get '/section_a' | |
assert_response :success | |
end | |
end |
View gist:3b3762c74355f42ac7bc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_customer | |
if customer_id = session[:customer_id] | |
@customer = Customer.find_by_id(customer_id) | |
end | |
end |
View gist:44f6c7293f25cf69382d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_storefront_resilient_to_sessions_down | |
Toxiproxy[:sessions_data_store].down do | |
get '/' | |
assert_equal 'Customer sign in is currently unavailable', flash[:notice] | |
assert_response :success | |
end | |
end |
View gist:f3111d7f12f9d736d68a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_customer | |
if customer_id = session[:customer_id] | |
@customer = Customer.find_by_id(session[:customer_id]) | |
end | |
# in reality e.g. a redis exception thrown from the driver | |
# could be raised from circuit breaker or semian as well (see later) | |
rescue Sessions::DataStoreUnavailable | |
flash[:notice] = 'Customer sign in is currently unavailable' | |
@customer = nil | |
end |
View setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WORKDIR="/home/vagrant/src" | |
clone_repo() { | |
local name=$1; shift | |
local repo=$1; shift | |
if [[ ! -d "$WORKDIR/$name" ]]; then |
OlderNewer