Skip to content

Instantly share code, notes, and snippets.

View MrMarvin's full-sized avatar
🇪🇺
Working from home

Marv MrMarvin

🇪🇺
Working from home
View GitHub Profile
@MrMarvin
MrMarvin / cloud_front.rb
Last active September 6, 2017 05:44
request log analyzer CloudFront with AWS region
require 'json'
require 'ipaddr'
class IPAddr
def to_cidr_string
mask = @mask_addr.to_s(2).count('1')
"#{self.to_s}/#{mask}"
end
def aws_region=(region)
@aws_region = region
@MrMarvin
MrMarvin / is_aws_addr.rb
Created July 4, 2017 16:41
script to check if a given list of IPv4 addresses belong to an AWS AS / IP range
#
# Usage exampe: `cut -f5 access.log | ruby ./is_aws_addr.rb`
#
AWS_IP_RANGES_PATH = '/tmp/aws-ip-ranges.json'
require 'json'
require 'ipaddr'
class IPAddr
@MrMarvin
MrMarvin / 42_filter.haproxy_cf_ray_iata_to_geolocation
Created February 8, 2016 07:18
A logstash filter to extract IATA codes and insert its geo location
filter {
ruby {
code => "
if event['request_header_cf_ray'] and not event['geoip']
iata = event['request_header_cf_ray'].split('-')[1]
event['request_header_cf_ray_datacenter'] = iata
event['request_header_cf_ray_geolocation'] = @location[iata]
event['geoip'] = {
'location' => [@location[iata].split(',')[1].to_f, @location[iata].split(',')[0].to_f],
(salt)[root@master1-salt1 salt]# PYTHONPATH=/vagrant/salt/:/vagrant/salt/src/salttesting/ pylint --rcfile=/vagrant/salt/.pylintrc /vagrant/salt/
No handlers could be found for logger "salttesting.pylintplugins.pep8"
Traceback (most recent call last):
File "/usr/bin/pylint", line 4, in <module>
lint.Run(sys.argv[1:])
File "/usr/lib/python2.6/site-packages/pylint/lint.py", line 829, in __init__
linter.load_plugin_modules(plugins)
File "/usr/lib/python2.6/site-packages/pylint/lint.py", line 275, in load_plugin_modules
module.register(self)
File "/vagrant/salt/src/salttesting/salttesting/pylintplugins/pep263.py", line 92, in register
% ACM Transactions bibliography style (24-Jan-88 version)
% A lot like abbrv.bst, but names come out "Last, initials", and in \sc.
% Some dates are parenthesized.
%
% History
% 2/ 6/86 (HWT) Original version, by Howard Trickey.
% 3/ 5/86 (HWT) Put in pp. everywhere but articles, as per ACM style.
% 1/24/88 (OP&HWT) Updated for BibTeX version 0.99a, Oren Patashnik;
% corrected the abbreviations to "Mar." and "Sept.";
% 10/12/2013 (Marvin Frick) replaced " and " with german " und ".
@MrMarvin
MrMarvin / gist:4023634
Created November 6, 2012 09:13
rvm use --debug
This file has been truncated, but you can view the full file.
/Users/marv/.rvm/scripts/base:11 /Users/marv/.rvm/scripts/base:11 then if[[ -z 5.0.0 ]]
/Users/marv/.rvm/scripts/base:21 /Users/marv/.rvm/scripts/base:21 export __array_start rvm_path
/Users/marv/.rvm/scripts/base:26 /Users/marv/.rvm/scripts/base:26 if[[ -n 5.0.0 ]]
/Users/marv/.rvm/scripts/base:11 /Users/marv/.rvm/scripts/base:11 then if[[ -z 5.0.0 ]]
/Users/marv/.rvm/scripts/base:21 /Users/marv/.rvm/scripts/base:21 export __array_start rvm_path
/Users/marv/.rvm/scripts/base:26 /Users/marv/.rvm/scripts/base:26 if[[ -n 5.0.0 ]]
/Users/marv/.rvm/scripts/base:28 /Users/marv/.rvm/scripts/base:28 then__array_start=1
/Users/marv/.rvm/scripts/base:28 /Users/marv/.rvm/scripts/base:28 then__array_start=1
/Users/marv/.rvm/scripts/base:33 /Users/marv/.rvm/scripts/base:33 if(( 0 == 0 ))
/Users/marv/.rvm/scripts/base:35 /Users/marv/.rvm/scripts/base:35 then[[ -n 022 ]]