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/perl -w | |
while (<>) { | |
if (/nid=(0x[[:xdigit:]]+)/) { | |
$lwp = hex($1); | |
s/nid=/pid=$lwp nid=/; | |
} | |
print; | |
} |
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 declaration | |
lock() { | |
exec 200>/var/lock/.myscript.exclusivelock | |
flock -n 200 \ | |
&& return 0 \ | |
|| return 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
[Unit] | |
Description=gunicorn daemon | |
After=network.target | |
[Service] | |
PIDFile=/var/apps/gunicorn.pid | |
User=apps | |
Group=apps | |
WorkingDirectory=/var/apps/bans | |
ExecStart=/usr/local/bin/gunicorn --pid /var/apps/gunicorn.pid --bind unix:/var/apps/apps.sock wsgi:app |
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 | |
for i in `seq 1 10000` | |
do /bin/date +%Y-%m-%d-%H-%M-%S | |
mtr -n -c 600 -i 1 -r 10.147.0.46 > 10.147.0.46_$(/bin/date +%Y-%m-%d-%H-%M-%S).txt | |
done |
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
@echo off | |
set /p HOST="Enter IP address or FQDN: " | |
:while | |
set SAVESTAMP=%DATE:/=-%@%TIME::=-% | |
set SAVESTAMP=%SAVESTAMP: =% | |
echo %SAVESTAMP% | |
echo Next iteration... | |
pathping -q 100 -n %HOST% > %SAVESTAMP%.txt | |
GOTO while |
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 | |
# As the "bufferbloat" folks have recently re-discovered and/or more widely | |
# publicized, congestion avoidance algorithms (such as those found in TCP) do | |
# a great job of allowing network endpoints to negotiate transfer rates that | |
# maximize a link's bandwidth usage without unduly penalizing any particular | |
# stream. This allows bulk transfer streams to use the maximum available | |
# bandwidth without affecting the latency of non-bulk (e.g. interactive) | |
# streams. |
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
set -e | |
set -u | |
# hat-tips: | |
# - http://codeghar.wordpress.com/2011/12/14/automated-customized-debian-installation-using-preseed/ | |
# - the gist | |
# required packages (apt-get install) | |
# xorriso |
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 | |
# This script allows you to backup a single volume from a container | |
# Data in given volume is saved in the current directory in a tar archive. | |
CONTAINER_NAME=$1 | |
VOLUME_NAME=$2 | |
usage() { | |
echo "Usage: $0 [container name] [volume name]" | |
exit 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
#!/bin/bash | |
# This script allows you to backup a single volume from a container | |
# Data in given volume is saved in the current directory in a tar archive. | |
CONTAINER_NAME=$1 | |
VOLUME_NAME=$2 | |
VOLUME_NAME_SANITIZED=$(echo $VOLUME_NAME | sed s#/#_#2g) | |
usage() { | |
echo "Usage: $0 [container name] [volume name]" | |
exit 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
-- Tit Petric, Monotek d.o.o., Tue 03 Jan 2017 06:54:56 PM CET | |
-- | |
-- Delete nginx cached assets with a PURGE request against an endpoint | |
-- supports extended regular expression PURGE requests (/upload/.*) | |
-- | |
function file_exists(name) | |
local f = io.open(name, "r") | |
if f~=nil then io.close(f) return true else return false end | |
end |
OlderNewer