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
cat */Maildir/.Junk/*/* | awk '/Delivery-date/ {d = $2" "$3" "$4" "$5} /Spam_score_int/ {print d" "$2}' |
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
# total apache hits by vhost on a log | |
cat other_vhosts_access.log | awk '{ print $1 }' | sort | uniq -c | sort -nr | |
# total apache hits by day on a log | |
cat other_vhosts_access.log | awk '{ print substr($5, 2, 11) }' | uniq -c | |
# total apache hits by month on every other_vhosts_access.log* | |
zcat other_vhosts_access.log.*.gz | cat - other_vhosts_access.log other_vhosts_access.log.1 | awk '{ print substr($5, 5, 8) }' | sort | uniq -c | |
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
awk 'BEGIN { host = "/inet/tcp/8080/0/0"; while (1) { print "HTTP/1.1 200 OK" |& host; print "\r\nHello World" |& host; close(host); } }' | |
while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; cat index.html; } | nc -l 8080; done |
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
curl -s https://www.jogossantacasa.pt/web/SCRss/rssFeedCartRes | xml2 | awk -F'=' '/Euromilhões/ {c=0;e=1} e&&++c==3{print $2}' | sed -r 's/<\/?b>//g' | |
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 os, GeoIP, fileinput | |
geo = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE) | |
for line in fileinput.input(): | |
try: | |
print(geo.country_code_by_addr(line.strip())) | |
except IOError: | |
break |
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
topc=( US CN FR SE RU UA CA MD A1 PL ) | |
rm derp.json | |
for c in "${topc[@]}" | |
do | |
echo $c | |
echo ", {" >> derp.json | |
echo " name: '$c'," >> derp.json | |
echo " data: [" >> derp.json |
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
# flaten a list of lists | |
[y for x in list for y in x] | |
# transform month to int | |
['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Oct', 'Sep', 'Nov', 'Dec'].index(m) + 1 | |
# generate part of a slug from a name | |
slug = re.sub('[^\w\d]+', '-', name).strip('-').lower() | |
# check if it's a sequence (of numbers) |
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
egrep -v "^#|^$" file.cfg |
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
cat other_vhosts_access.log | awk '$10 == 500 { print $5 $6}' | grep -o -e "../.../....:.." | sort | uniq -c | sort -r -n -k 1,1 | head -n 10 |
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
""" vxf | |
Funcoes uteis para estudar Probabilidades e Estatistica | |
Exemplos de uso: | |
S(0, 5, lambda i: Bin(n=7, p=(4/6), x=i)) | |
""" | |
from math import factorial | |
from functools import reduce |
OlderNewer