Skip to content

Instantly share code, notes, and snippets.

View adionditsak's full-sized avatar

Anders Aarvik adionditsak

View GitHub Profile
@adionditsak
adionditsak / tput_menu.sh
Created February 23, 2015 08:19
tput cli menu dummy with 4 options
#!/bin/bash
tput clear
main_menu()
{
until [ option = 4 ]; do
tput setb 2
tput setf 5
read -p """
@adionditsak
adionditsak / cecho.sh
Created February 4, 2015 07:10
cecho.sh - colorize shell output with pipe
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"
#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 August 29, 2015 14:13
Count files appended last 10 seconds for access logs and errors logs...
#!/bin/bash
# Count appended lines last 10 seconds simultanously
# CentOS/RHEL
LOGPATH="/var/log/httpd/"
# Ubuntu/Debian
# LOGPATH="/var/log/apache2/"
@adionditsak
adionditsak / memcached_errors.txt
Last active August 29, 2015 14:05
make memcached errors
[root@... memcached-2.2.0]# make
/bin/sh /usr/local/php5515/bin/memcached-2.2.0/libtool --mode=compile cc -I/usr/include/php -I. -I/usr/local/php5515/bin/memcached-2.2.0 -DPHP_ATOM_INC -I/usr/local/php5515/bin/memcached-2.2.0/include -I/usr/local/php5515/bin/memcached-2.2.0/main -I/usr/local/php5515/bin/memcached-2.2.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/php5515/bin/memcached-2.2.0/php_memcached.c -o php_memcached.lo
libtool: compile: cc -I/usr/include/php -I. -I/usr/local/php5515/bin/memcached-2.2.0 -DPHP_ATOM_INC -I/usr/local/php5515/bin/memcached-2.2.0/include -I/usr/local/php5515/bin/memcached-2.2.0/main -I/usr/local/php5515/bin/memcached-2.2.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/php5515/bin/memcached-2.2.0/p
@adionditsak
adionditsak / add_server_to_ad.ps1
Created August 4, 2014 12:51
Adds/signs server to AD/Active Directory
# Set DNS to Primary AD
$eth = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$dns_servers = "1.2.3.4"
$eth.SetDNSServerSearchOrder($dns_servers);
# Add domain
$domain = "domain.local"
$password = "password" | ConvertTo-SecureString -asPlainText -Force
$username = "$domain\Administrator"
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
@adionditsak
adionditsak / dns_smtp_test.py
Last active August 29, 2015 14:04
Simple DNS + SMTP test script - writes to CSV
#!/usr/bin/env python3
import sys
import csv
import random
import time
import smtplib
import dns.resolver
class DNS():
input {
stdin {
type => "stdin-type"
}
file {
type => "apache"
path => ["/var/log/apache2/access.log", "/var/log/apache2/ error.log"]
}
@adionditsak
adionditsak / debian-nw-conf
Last active August 29, 2015 13:56
A bit of eth0 and nw configuration for Debian snippets - static ip
# eth0
$ vim /etc/network/interfaces
# Auto generated lo interface
auto lo
iface lo inet loopback
# Static ip
iface eth0 inet static
address 10.0.0.50
@adionditsak
adionditsak / centos-nw-conf
Last active August 29, 2015 13:56
A bit of eth0 and nw configuration for CentOS snippets - static ip
# eth0
$ vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
NAME="eth0"
IPADDR=ipaddress