Skip to content

Instantly share code, notes, and snippets.

View antonlindstrom's full-sized avatar
👓

Anton Lindström antonlindstrom

👓
View GitHub Profile
@antonlindstrom
antonlindstrom / dnscheck
Created July 22, 2011 10:13
keepalived for DNS
#!/bin/bash
#$Id: keepalivepin,v 1.2 2006/02/27 07:30:41 hmy Exp hmy $
#use dig check the powerdns's status.
#in the dns database,have a IN TXT RR keepalivepin.vmmatrix.net,content is "AaBbCcDdEeFf"
# Source: http://puppet-manifest-share.googlecode.com/svn/trunk/vmx-puppet/modules/lvs/files/keepalived.dns-pin
#
RR=keepalivepin.vmmatrix.net
[ $# -le 1 ]&&{ echo "usage: ${0} -h <ip>"; exit 126;}
while getopts "h:" OPT;do
case $OPT in
@antonlindstrom
antonlindstrom / spark-wordcount-sorted.py
Created March 13, 2014 16:47
Spark Wordcount Job that lists the 20 most frequent words
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#

Keybase proof

I hereby claim:

  • I am antonlindstrom on github.
  • I am antonl (https://keybase.io/antonl) on keybase.
  • I have a public key ASC0-oxgetbcz6dSKBKlVGf0laUql6EnWZSqfAa-CRNVzQo

To claim this, I am signing this object:

@antonlindstrom
antonlindstrom / gist:5691828
Last active December 17, 2015 23:49
Example Ruby 2.0 Dockerfile
# Ruby 2.0
#
# VERSION 0.0.1
FROM ubuntu
MAINTAINER Anton Lindstrom "anton@alley.se"
RUN apt-get install -y build-essential
RUN apt-get install -y bison openssl wget
RUN apt-get install -y libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev
@antonlindstrom
antonlindstrom / domains.pp
Created March 8, 2013 12:54
Rewrites to HTTPS and domain mapping
config_extra => [
'RewriteEngine On',
'RewriteMap domains txt:/etc/apache2/domains.txt',
"RewriteCond %{HTTP_HOST} !${::ipaddress_eth1}|${::fqdn}",
'RewriteRule ^/$ ${domains:%{HTTP_HOST}} [NC,L,R=301]',
'RewriteCond %{HTTPS} off',
'RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [NC]',
],
@antonlindstrom
antonlindstrom / gist:5107132
Created March 7, 2013 10:36
Rewrite domains w\ RewriteMap
<VirtualHost *:80>
ServerAdmin webmaster@localhost
RewriteEngine On
RewriteMap exampledomain txt:/etc/apache2/domains.txt
RewriteRule ^/$ ${exampledomain:%{HTTP_HOST}}
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 5
@antonlindstrom
antonlindstrom / check_file_size.pl
Created December 7, 2012 08:12
Nagios check for checking size of a file
#!/usr/bin/perl
### check_file_size.pl
# Based on check_backup.pl by Nathan Vonnahme
#
use strict;
use warnings;
use File::stat;
use Getopt::Long;
e1b7418ca70a889337b0f67e18fb6176
e1b7418ca70a889337b0f67e18fb6176
@antonlindstrom
antonlindstrom / fog.rb
Created September 18, 2011 11:48
Examples of the Glesys API in fog
anton:~ 3> ./bin/fog
Welcome to fog interactive!
:default provides Glesys, VirtualBox and VirtualBox
>> compute = Compute.new(:provider => 'glesys')
>> # The output has been removed, it will show the connection information
>> # Below command will show all servers on the account
>> compute.servers.all
<Fog::Compute::Glesys::Servers
[]
>
@antonlindstrom
antonlindstrom / check_raid
Created September 8, 2011 13:28
nagios check for linux software raid
#!/usr/bin/perl -w
# vim:ts=4
#
# Check RAID status. Look for any known types
# of RAID configurations, and check them all.
# Return CRITICAL if in a DEGRADED state, since
# if the whole array has failed you'll have already noticed it!
# Return UNKNOWN if there are no RAID configs that can be found.
# Return WARNING if rebuilding or initialising
#