- Port
80
should be open on the server so kibana can be accessed - Port
5000
should be open for incoming traffic vialogstash-forwarder
akalumberjack
(this is where logstash data comes in). I set this to0.0.0.0/0
although you could restrict it to just the internal machines you are monitoring.
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
export $(echo PATH1 PATH2 PATH3 | xargs -n 1 -I {} vault read -format=json {} | jq -rs 'map(.data.data) | add | keys[] as $k | "\($k)=\(.[$k])"') |
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/sh | |
# Get the HEAD commit hash | |
HEAD=$(git rev-parse HEAD) | |
# Generate a list of all commit hashes in the repository | |
git rev-list --no-merges --all | while read COMMIT; do | |
# Compare the commit to the HEAD | |
if [ -z "$(git diff --name-only $COMMIT $HEAD)" ]; then | |
# If there are no differences, exit the loop and return the commit hash |
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
#!/usr/bin/env bash | |
CACHE_FILE=${HOME}/.kube/cache/aws-${AWS_PROFILE}.cache | |
MAXTIME=800 | |
if [ -f $CACHE_FILE ]; then | |
TS_DB=$(stat -t "%s" ${CACHE_FILE} | cut -d' ' -f10 | tr -d '"') | |
AGE=$(( `date +%s` - $TS_DB )) | |
if [[ $AGE -le $MAXTIME ]]; then | |
cat ${CACHE_FILE} | |
else | |
aws "$@" | tee $CACHE_FILE |
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
# convert a number to letters only - no size limit | |
1.to_s.tr("0-9", "A-J") |
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 | |
sudo apt-get install ntp -y | |
sudo service ntp stop | |
sudo ntpdate -s time.nist.gov | |
sudo service ntp start |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
# fix boot2docker network timeouts (check boot2docker network interface name, mine is vboxnet0, yours may vary) | |
sudo route -nv add -net 192.168.59 -interface vboxnet0 | |
#u: inet 192.168.59.0; u: link vboxnet0:a.0.27.0.0.0; RTM_ADD: Add Route: len 140, pid: 0, seq 1, errno 0, flags:<UP,STATIC> | |
#locks: inits: | |
#sockaddrs: <DST,GATEWAY,NETMASK> | |
# 192.168.59.0 vboxnet0:a.0.27.0.0.0 (0) 0 ffff ff | |
# add net 192.168.59: gateway vboxnet0 |
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
# - simplified | |
module Goals | |
class WeightLossGoal < Goal | |
db_identifier :weight_loss_goal | |
validates_goal_with do |user, amount_weight| | |
# user is the user we are validating against | |
if amount_weight >= user.weight | |
raise InvalidGoalError.new('cannot lose more than you weigh') |
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
// PNG file structure | |
// taken from: http://www.w3.org/TR/REC-png-961001#Structure | |
var xhr = new XMLHttpRequest; | |
xhr.onreadystatechange = function () { | |
if (xhr.readyState != 4) { | |
return; | |
} | |
debugger; |
NewerOlder