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/perl | |
# Usage: tcpdump -i ng10 -l -e -n dst host 192.168.1.200 | ./tcpdump_bps.pl | |
use strict; | |
use warnings; | |
use Time::HiRes; | |
my $reporting_interval = 10.0; # seconds | |
my $bytes_this_interval = 0; | |
my $start_time = [Time::HiRes::gettimeofday()]; |
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/python | |
# You can also do it by hands: | |
# iptables -t filter -A FORWARD -p udp -m udp --dport 53 -m string --hex-string "|05|yadro|02|ru" --algo bm -j DROP | |
import sys | |
import os | |
if len(sys.argv) < 2: | |
sys.exit('Usage: %s domain.com' % sys.argv[0]) |
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/sh | |
#-------VARIABLES------- | |
VZLIST_CMD=/usr/sbin/vzlist | |
VZDUMP_CMD=/usr/sbin/vzdump | |
DUMP_PATH=/var/backup/vzdump/current | |
SCP_UPLOAD_ENABLE=0 | |
[email protected]:/backup |
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 | |
osmosis="/usr/local/bin/osmosis" | |
log="/tmp/openstreetmap2drsk_gis.log" | |
var_dir="/var/gis_update" | |
osm_new="${var_dir}/osm_new.osm" | |
osm_prev="${var_dir}/osm_prev.osm" | |
diff_api_changes="${var_dir}/diff_api_changes.osc" | |
need_to_render="${var_dir}/tiles_to_render.list" | |
# export current OSM db |
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
Set-Alias ngen (Join-Path ([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) ngen.exe) | |
[AppDomain]::CurrentDomain.GetAssemblies() | | |
sort {Split-path $_.location -leaf} | | |
%{ | |
$Name = (Split-Path $_.location -leaf) | |
if ([System.Runtime.InteropServices.RuntimeEnvironment]::FromGlobalAccessCache($_)) | |
{ | |
Write-Host "Already GACed: $Name" | |
}else | |
{ |
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
// Usage: Object.byString(someObj, 'part3[0].name'); | |
// Demo: http://jsfiddle.net/alnitak/hEsys/ | |
Object.byString = function(o, s) { | |
s = s.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties | |
s = s.replace(/^\./, ''); // strip a leading dot | |
var a = s.split('.'); | |
for (var i = 0, n = a.length; i < n; ++i) { | |
var n = a[i]; | |
if (n in o) { |
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
var isInPolygon = function (pointLanLng, polygon) { | |
var n, i, j, xi, xj, yi, yj, intersect, | |
inside = false, | |
x = pointLanLng.lat, y = pointLanLng.lng, | |
polygonLatLngs = polygon.getLatLngs(); | |
for (n = 0; n < polygonLatLngs.length; n = n+1) { | |
for (i = 0, j = polygonLatLngs[n].length - 1; i < polygonLatLngs[n].length; j = i++) { | |
xi = polygonLatLngs[n][i]['lat']; |
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/sh | |
EMAIL=$1 | |
MAILLOG_FILE=/var/log/mail/maillog | |
if [[ $EMAIL =~ "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+" ]]; then | |
cat $MAILLOG_FILE | grep $EMAIL | awk -F": " '{print $2}' | grep -v "NOQUEUE" | xargs -I{} sh -c "grep {} $MAILLOG_FILE --color=auto; echo '-----------------------'" | |
else | |
echo "Use like: mailfind [email protected]" | |
fi |
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
@echo off | |
setlocal | |
set Folder=c:\test\oldfiles | |
set MaxFiles=3 | |
set FileExt=.png | |
:start | |
dir "%Folder%\*%FileExt%" /a-d | find /c "%FileExt%" > NUMfiles.### | |
set /p count=<NUMfiles.### |
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
mongodump --db elementario --out /var/mongodump/`date +%Y_%m_%d____%H_%M` |
OlderNewer