This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyinotify,subprocess | |
def onChange(ev): | |
cmd = ['/bin/echo', 'File', ev.pathname, 'changed'] | |
subprocess.Popen(cmd).communicate() | |
wm = pyinotify.WatchManager() | |
wm.add_watch('/var/lib/dhcp/dhcpd.leases', pyinotify.IN_MODIFY, onChange) | |
notifier = pyinotify.Notifier(wm) | |
notifier.loop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function main() | |
{ | |
monitor_from_file $* | |
} | |
function monitor_vpn_ip_port() | |
{ | |
local CONN_NAME=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env expect | |
set CTRLZ \032 | |
set action [lindex $argv 0] | |
set vlan [lindex $argv 1] | |
if {[llength $vlan] == 0} { exit 0; } | |
if {$vlan < 3000} { exit 0; } | |
if {$vlan > 9100} { exit 0; } | |
stty -echo | |
send_user -- "Gimme Passwordz: " | |
expect_user -re "(.*)\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#Copyright (C) 2009 Allen Sanabria | |
#This program is free software; you can redistribute it and/or modify it under | |
#the terms of the GNU General Public License as published by the Free Software Foundation; | |
#either version 2 of the License, or (at your option) any later version. | |
#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | |
#without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
#See the GNU General Public License for more details. You should have received a copy of i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
NUM_WORKERS=3 | |
USER=www-data | |
GROUP=users | |
DIR=$(dirname $0) | |
APPNAME=${DIR##*/} | |
LOGFILE=/var/log/gunicorn/$APPNAME.log | |
LOGDIR=$(dirname $LOGFILE) | |
cd $DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
formulas="django dnsmasq haproxy nginx ntp owncloud php postfix users varnish vim" | |
formula_root=/srv/formula | |
states_root=/srv/salt | |
pillars_root=/srv/pillar | |
[ ! -d $formula_root ] && mkdir $formula_root | |
cd $formula_root | |
for f in $formulas;do | |
ff=$f-formula | |
if [ ! -d $formula_root/$ff ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
# -*- coding: utf-8 -*- | |
import sys | |
import ldap | |
from credz import ldap as _c | |
## You can just set the variables on the next 4 lines directly | |
## - or you can create your own credential handler | |
base_dn = _c.base_dn # CN=users,DC=domain,dc=example,dc=com | |
ldap_user = _c.username # user@domain.example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -e | |
[ "x" == "x$(dig +short @10.0.0.1 -x 10.0.0.1)" ] && exit 0 | |
header="### This file is generated by $0 ### | |
127.0.0.1 localhost | |
127.0.1.1 $(hostname)" | |
footer="# The following lines are desirable for IPv6 capable hosts | |
::1 ip6-localhost ip6-loopback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### Linux FTW! Because this is how you get a ringtone for you mobile/cell phone | |
### I did this is on a Ubuntu 15.04 | |
VID=[YOUTUBE_VIDEO_ID] | |
# Get the video and extract the audio on the fly | |
# sudo apt-get -y install youtube-dl | |
youtube-dl -o '%(id)s.%(ext)s' -x --audio-format best https://www.youtube.com/watch?v=$VID | |
# Cut the beginning of the audio track so it starts from 4 seconds in and continues for 31 secs. | |
# At the same time convert the audio track from AAC to OGG (my Android phone loves that for ringtones) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get -y install libssl-dev libev-dev clang autoconf automake | |
git clone https://github.com/varnish/hitch.git | |
cd hitch | |
export CC=clang | |
./bootstrap | |
./configure --prefix=/usr | |
make -j4 | |
cd src/tests && runtests && cd ../.. | |
sudo cp hitch.conf.ex /etc/hitch.conf |
OlderNewer