This file contains hidden or 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
| # /etc/nginx/geoblocker | |
| # This will block anything but the defined countries and the networks defined in the $localnet variable | |
| set $geoblock 0; | |
| if ($geoip_country_code !~ (DK|NO|SE)) { set $geoblock 1; } | |
| if ($localnet = 1){ set $geoblock 0; } | |
| if ($geoblock = 1){ return 403; } |
This file contains hidden or 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 hidden or 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 hidden or 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
| apg -n30 -MCLNS -E "'~\`><{}[]()|\"\\/^" | |
| # This will generate 30 passwords that will contain | |
| # - at least one digit | |
| # - at least one Capital letter | |
| # - at least one special symbol | |
| # - at least one lower cased | |
| # -E is for Excluding certain characters I dislike in my passwords |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
| F=/var/lib/libvirt/images/ubuntu.img | |
| sudo qemu-img resize $F 50G | |
| sudo virsh blockresize --path $F --size $(qemu-img info $F|sed -n '/virtual size/ s/^.*: //;s/(.*//p') <domain-id> |
This file contains hidden or 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 | |
| #Script to backup KVM-machines using snapshots. | |
| #Written by Jonas "Drakfot" Andersson | |
| #Changelog | |
| # Version 1.1 | |
| #20140309 - Initial scripting started. | |
| #20140316 - Fixed an issue where a nonmounted drive (CD) could cause the script to fail. | |
| #also sorted the part where the converted image will end up. Now the file is written |
This file contains hidden or 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 | |
| ### First we get the controller ID (e.g. c0) | |
| CT=$(tw-cli info | sed -n 's/\(c[0-9]\).*/\1/p') | |
| ### Then we list all drives on that controller | |
| DRV=$(tw-cli /$CT show drivestatus | sed -n 's/\(p[0-9]\).*/\1/p' | xargs) | |
| ### Last we loop over the disks we found and read out the temperature on each of them | |
| echo "3ware temperatures: $(for d in $DRV; do |
OlderNewer