Skip to content

Instantly share code, notes, and snippets.

View adionditsak's full-sized avatar

Anders Aarvik adionditsak

View GitHub Profile
<?php
/*
*
* Get your Facebook-statuses and Twitter-tweets on your website with ease.
* Go to http://feedburner.com and burn your feed.
* Use your feedburner-url with this class to set feed.
*
* Author: Anders Aarvik
*
*/
#!/usr/bin/env bash
# vars #
disk="/dev/disk0s2" # disk to monitor
current_usage=$(df -h | grep ${disk} | awk {'print $5'}) # get disk usage from monitored disk
max_usage="20%" # max 90% disk usage
mail="aarvik92@gmail.com" # mail to sent alert to
# functions #
function max_exceeded() {
@adionditsak
adionditsak / apache.pp
Created December 25, 2013 00:04
Maintain Apache2
class apache {
notify {'Apache2':
before => Service['apache2']
}
exec {'apt-get update':
command => '/usr/bin/apt-get update'
}
#!/usr/bin/env python
"""
FileCli
"""
import sys, os
class FileOperation():
@adionditsak
adionditsak / backup_dir.sh
Last active August 29, 2015 13:56
Backup valuable content swiftly without much struggle
#!/usr/bin/env bash
#### DEPENDENCIES: mutt
#### VARS
MAIL=mail@goeshere.tld
DATE=$(date +%Y-%m-%d)
LOCAL_BACKUP=/path/to/backup
LOCAL_ARCHIVE=$HOME/backup-${DATE}.tar.gz
@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
@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
input {
stdin {
type => "stdin-type"
}
file {
type => "apache"
path => ["/var/log/apache2/access.log", "/var/log/apache2/ error.log"]
}
@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():
@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)