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 | |
#show size of remote file, should fetch only header | |
curl 'http://www.ruhbarbdownloads.remote'\ | |
--silent -H 'Accept-Encoding: gzip,deflate'\ | |
--write-out 'size_download=%{size_download}\n'\ | |
--output /dev/null | |
#show header | |
curl -sI 'http://www.ruhbarbdownloads.remote' #| awk '/Content-Length/ { print $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
#nix date conversion | |
# time2unixStamp | |
date -d "2016/03/01 01:00:00" "+%s" | |
#readline | |
while read line ; do echo $line\;$(date -d "$t" "+%s") ; done < $1 | |
#unixTime2human | |
date -d @1458636426 | |
awk '{ print strftime("%c", $0); }' $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
# Dates YYYY-MM-DD HH:MM:SS | |
grep -oP '[1-2][90][0-9]{2,2}([-/ ])[0-2][0-9]\1[0-2][0-9] [0-2][0-9]([:])[0-6][0-9]\2[0-6][0-9]' | |
# | |
perl -pe 's/[^[:ascii:]]//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
#!/bin/sh | |
sed -re ' | |
s/^.*$/<tr>\n<td>&<\/td>\n<\/tr>/g | |
s/[,]/<\/td>\n<td>/g | |
1i <table style="width:100%"> | |
$a\<\/table>' "$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
#!/bin/sh | |
sed -re 's/[%]([[:xdigit:]]{,2})/\\\x\1/g' "$1"| xargs -0 printf '%b' |
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
#print occurrance off ;,|[:TAB:] | |
#this might be the delim | |
awk -vFS="" '{for(i=1;i<=NF;i++){ if($i~/[,;| ]/) { w[tolower($i)]++} } }END{for(i in w) print i,w[i]}' file.csv |sort -n|head -1|cut -f1 -d" " | |
#find longest line | |
awk -F"$DELIM" '{ if ( length > L ) { L=length} }END{ print L}' $1 | |
#fix commas after quotes, good for cleaning csv files | |
awk -F'"' -v OFS='' '{ for (i=2; i<=NF; i+=2) gsub(",", "", $i) } 1' $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
#!/bin/slurp | |
# modeline and info {{{1 # | |
# vim: set ft=sh foldmethod=marker foldmarker={{{,}}} foldenable | |
####################################################################### | |
# build script for vim. # | |
# see http://vim.wikia.com/wiki/Building_Vim # | |
####################################################################### | |
# 1}}} # | |
# remove vim first {{{ # |
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
find . | xargs head -n1 | strings | grep :// > squid-urls.txt #list of urls in squid cache | |
#purge pattern from cache | |
for x in `cat squid-urls.txt | grep foo`; do | |
squidclient -m PURGE $x ; | |
done | |
#format the dates | |
perl -p -e 's/^([0-9\.]*)/"[".localtime($1)."]"/e' *.log |