Skip to content

Instantly share code, notes, and snippets.

Anders Aarvik adionditsak

View GitHub Profile
@adionditsak
adionditsak / consul
Created Jan 30, 2017
consul startup/service script (ubuntu 14)
View consul
#
# Daemon for consul
#
# chkconfig: 345 98 20
# description: Daemon for consul
# processname: consul
### BEGIN INIT INFO
# Provides: consul
# Required-Start: $network
@adionditsak
adionditsak / vault
Created Jan 30, 2017
vault startup/service script (ubuntu 14)
View vault
#
# Daemon for vault
#
# chkconfig: 345 99 20
# description: Daemon for vault
# processname: vault
### BEGIN INIT INFO
# Provides: vault
# Required-Start: $network
@adionditsak
adionditsak / elasticsearch_lastlog.py
Last active Feb 2, 2017
Check_mk plugin to check for last log from Elasticsearch compared to current time
View elasticsearch_lastlog.py
#!/usr/bin/env python
import requests
import datetime
import json
import os
"""
Check_mk plugin to check for last log from Elasticsearch compared to current time
"""
@adionditsak
adionditsak / generatehostsfile.sh
Created Feb 12, 2016
Generate hosts file with AWS ec2 private IP's
View generatehostsfile.sh
#!/bin/bash
# Generate hosts-file with private IP's in AWS ec2
# Vars
hosts_file="/etc/hosts"
region="eu-west-1"
# AWS call
described_instances=`aws ec2 describe-instances --region ${region}`
@adionditsak
adionditsak / tput_menu.sh
Created Feb 23, 2015
tput cli menu dummy with 4 options
View tput_menu.sh
#!/bin/bash
tput clear
main_menu()
{
until [ option = 4 ]; do
tput setb 2
tput setf 5
read -p """
@adionditsak
adionditsak / SRX cheatsheet
Created Feb 17, 2015
Juniper SRX cheatsheet
View SRX cheatsheet
# Juniper SRX cheatsheet
#Help
help
<command> ?
#Show
show configuration
@adionditsak
adionditsak / cecho.sh
Created Feb 4, 2015
cecho.sh - colorize shell output with pipe
View cecho.sh
cecho(){
BLACK="\033[0;30m"
BLUE="\033[0;34m"
GREEN="\033[0;32m"
CYAN="\033[0;36m"
RED="\033[0;31m"
PURPLE="\033[0;35m"
ORANGE="\033[0;33m"
LGRAY="\033[0;37m"
DGRAY="\033[1;30m"
View GHOST.c
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
struct {
char buffer[1024];
@adionditsak
adionditsak / countrequests.sh
Last active Aug 29, 2015
Count files appended last 10 seconds for access logs and errors logs...
View countrequests.sh
#!/bin/bash
# Count appended lines last 10 seconds simultanously
# CentOS/RHEL
LOGPATH="/var/log/httpd/"
# Ubuntu/Debian
# LOGPATH="/var/log/apache2/"
@adionditsak
adionditsak / RELK.sh
Last active Jun 4, 2019
Install the ELK stack (with Redis) with one script for the central log server (CentOS 6.5).
View RELK.sh
#/bin/bash
##########################################################
### INTRODUCTION
##########################################################
: '
Install and configure R (Redis) + ELK server from scratch on CentOS 6.5.
* Logstash version 1.4.2
* Elasticsearch version 1.3.2
You can’t perform that action at this time.