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 | |
echo "Statistik für Logfile $1" | |
awk '{sum+=$10} END {printf "%.2f GByte Transfervolumen\n",sum/1073741824}' $1 | |
echo "$(wc -l < "$1" | sed 's/[^[:digit:]]//g') Requests" | |
#echo "$(grep -ivE '(.js|.css|.pdf|.gif|.jpg|.jpeg|.png|.tif|.tiff|.mp3|.mp4a|.aac|.mpg|.mp4|.mov|.flv|.swf|.zip|.gz|.rpm|.tgz|.doc|.xls|.ppt|.wmv|.avi|.wav|.ico|.exe)' "$1" | wc -l | sed 's/[^[:digit:]]//g') Requests auf Assets" |
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 | |
# Or try awk '{sum+=$10} END {print sum/1048576}' | |
#export LC_ALL=C | |
#env LC_ALL=en_US sort | |
unset LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME | |
bytes_in_mb=1048576 | |
bytes_in_gb=1073741824 |
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 ruby | |
require 'rubygems' | |
require 'json' | |
require 'google/api_client' | |
require 'active_support/core_ext/hash' | |
# 1. Go to Google Cloud Console (https://cloud.google.com/console) | |
# 2. Create Service Account with P12 File | |
# 3. Enable the Admin SDK in APIs. |
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 | |
# bin/elb-describe-lbs | awk '{print $2}' | xargs -n1 elb-set-secure-policy.sh | |
ELB=$1 | |
echo "Setting Policy on Load Balancer $1" | |
bin/elb-create-lb-policy $ELB \ | |
--policy-type SSLNegotiationPolicyType \ | |
--policy-name elb-secure-ssl \ |
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
find . -name "*.extension" -print0 | xargs -0 ruby -i -p -e '$_.gsub! %r{(THIS)}, "THAT was \\1"' |
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
find . -maxdepth 1 -name "*.git" -type d -exec git gc "{}" ";" |
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
# 1. Generate a model Presence before: | |
# rails generate model presence ap_mac:string client_mac:string last_seen:datetime rssi:integer | |
# | |
# 2. Add a route: | |
# match 'meraki', :to => 'meraki#presenceapi', :as => :meraki | |
# | |
# 3. Test this controller via: | |
# curl -d data="{\"secret\":\"foobar\",\"probing\":[{\"ap_mac\":\"00:aa:bb:cc:dd:ee\",\"client_mac\":\"ff:ee:dd:cc:bb:aa\",\"last_seen\":\"Wed Jan 22 08:34:02.409 UTC 2014\",\"rssi\":\"16\"},{\"ap_mac\":\"11:22:33:44:55:66\",\"client_mac\":\"99:88:77:66:55:44\",\"last_seen\":\"Wed Jan 22 08:34:06.409 UTC 2014\",\"rssi\":\"29\"}]}" https://localhost:3000/meraki | |
# | |
# 4. Point Meraki to https://my.app.name/presenceapi |
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 'rubygems' | |
require 'openssl' | |
require 'digest/sha2' | |
require 'base64' | |
class CryptHelper | |
def self.generate_rsa_key(passphrase, bits = 4096) | |
cipher = OpenSSL::Cipher::AES256.new(:CBC) | |
rsa_key = OpenSSL::PKey::RSA.generate(bits) |
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
# Put this into lib/tasks | |
require 'rubygems' | |
require 'bundler' | |
require 'aws-sdk' | |
require 'socket' | |
require 'os' | |
if Rails.env.development? |
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
wget -q -O - \ | |
https://www.pingdom.com/rss/probe_servers.xml | \ | |
perl -nle 'print $1 if /IP: (([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5]));/' | \ | |
sort -n -t . -k1,1 -k2,2 -k3,3 -k4,4 |