This file contains hidden or 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
begin | |
puts "Hello World" | |
raise StandardError, '(╯°□°)╯︵ ┻━┻' | |
rescue => ಠ_ಠ | |
puts ಠ_ಠ.message | |
puts ಠ_ಠ.backtrace.join('\n') | |
end |
This file contains hidden or 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
frontend ssl | |
bind :443 ssl crt /etc/haproxy/crts npn spdy/2,http/1.1 | |
mode tcp | |
use_backend speedy if { ssl_fc_npn -m str spdy/2 } | |
default_backend http | |
frontend http_internal | |
bind 127.0.0.1:8443 |
This file contains hidden or 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
#!/usr/bin/env ruby | |
KNOWLEDGE = { | |
"gustavo" => ["learing ruby", "drinking beer", "sitting at the Spree"], | |
"duilio" => ["teaching ruby", "sunbathing", "doing stuff"], | |
"max" => ["eating great food", "another thing", "a third"] | |
} | |
def get_knowledge(person) | |
favorite_things = KNOWLEDGE[person] |
This file contains hidden or 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
# We use a temporary header to build our new Host header from the existing one | |
# and then directly perform a redirect | |
# Clean the request and remove any existing header named X-Rewrite | |
http-request del-header X-REWRITE | |
# Copy the Host header into X-Rewrite unchanged | |
http-request add-header X-REWRITE %[hdr(host)] if { hdr_end(host) .example.com } | |
# Change the X-REWRITE Header to contain out new host name |
This file contains hidden or 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
#!/usr/bin/env python | |
# Generate a new SHA512 shadow password hash from a given password | |
# Based on https://github.com/antoncohen/mksha | |
import getpass | |
import sys | |
# To install this library, use one of these: | |
# pip install passlib |
This file contains hidden or 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
http-request del-header X-Redirect-To | |
http-request set-header X-Redirect-To %[req.uri] if { path_beg /a } | |
http-request replace-header X-Redirect-To /a/(.*) /b/\1 if { hdr_cnt(X-Redirect-To) gt 0 } | |
http-request redirect location %[req.hdr(X-Redirect-To)] if { hdr_cnt(X-Redirect-To) gt 0 } |
This file contains hidden or 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 'chef/http/http_request' | |
# Remove this patch once there is a released chef version which includes | |
# https://github.com/opscode/chef/pull/1471 | |
class Chef | |
class HTTP | |
class HTTPRequest | |
URI_SCHEME_DEFAULT_PORT ||= { 'http' => 80, 'https' => 443 }.freeze |
This file contains hidden or 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
# Set more reasonable ulimits | |
limit maxfiles 16384 32768 | |
limit maxproc 512 1024 | |
# Add /usr/local/bin to the global PATH used by all applications | |
# Be careful as this can affect the whole system when you install incompatible software here | |
setenv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin |
This file contains hidden or 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
frontend http | |
bind :80 | |
mode http | |
option http-server-close | |
# send request to the main backend until it has 50 parallel request | |
use_backend main if { be_conn(main) le 50 } | |
# send further requests to the others backend | |
use_backend others if { be_conn(main) gt 50 } |
This file contains hidden or 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 'openssl' | |
require 'base64' | |
require 'securerandom' | |
def hash_hostname(hostname, salt_b64=nil) | |
if salt_b64 | |
salt = Base64.decode64(salt_b64) | |
else | |
salt = SecureRandom.random_bytes(20) | |
salt_b64 = Base64.encode64(salt).strip |