Skip to content

Instantly share code, notes, and snippets.

@tomhat
tomhat / logtail.sh
Last active December 12, 2015 01:28
logtail.sh
#!/bin/sh
if [ ! $1 ]; then
/bin/echo "logtail.sh FILE"
exit 1
fi
CMD_SIZE=`/usr/bin/wc -c < $1`
NOWSIZE=$CMD_SIZE
if [ -f $1.offset ]; then
OFFSETSIZE=`/bin/cat $1.offset`
if [ $NOWSIZE -lt $OFFSETSIZE ]; then
@tomhat
tomhat / display_ranking_number.css
Created February 25, 2013 00:12
Stylish CSS (Chrome Extends,Firefox Add-on) Display ranking number at 3 Search Engine.
/* Google */
@-moz-document url-prefix("http://www.google.co.jp/"), url-prefix("https://www.google.co.jp/") {
body {
counter-reset: result !important;
}
h3.r:before {
content: counter(result) ". " !important;
counter-increment: result !important;
}
}
@tomhat
tomhat / gist:5386397
Created April 15, 2013 07:39
IE watermark support
<script src="http://code.jquery.com/jquery.js"></script>
<script text="text/javascript">jQuery.noConflict();</script>
<!--[if lt IE 10]>
<script type="text/javascript">
//place holder
jQuery(document).ready(function(){
jQuery('input[placeholder]').each(function(){
jQuery(this).watermark(jQuery(this).attr('placeholder'));
});
});
@tomhat
tomhat / record_vmstat.sh
Last active September 10, 2015 04:19
Recording vmstat result
/bin/echo -n `/bin/date +"%Y/%m/%d %H:%M:%S "` >> $1
/usr/bin/vmstat 1 5|/usr/bin/tail -n 1 >> $1
@tomhat
tomhat / record_iostat.sh
Created September 10, 2015 04:24
Recording iostat result
/bin/echo -n `/bin/date +"%Y/%m/%d %H:%M:%S "` >> $1
/usr/bin/iostat 1 5|/usr/bin/tail -n 1 >> $1
@tomhat
tomhat / gist:241653e7597032557324
Created September 27, 2015 20:09
add extension (mp4)
IFS=$'\n';for name in `find . ! -name "*.mp4" -name "B*" -print`; do mv $name $name.mp4; done;
@tomhat
tomhat / gist:d0ab8e053c83893724c48403e7c97810
Created October 18, 2016 20:23
unix / linux date YYYYMMDDhhmmss format print
/bin/date "+%Y%m%d%H%M%S"
@tomhat
tomhat / mail.sed
Last active October 19, 2016 23:38
maillog csv convert sed file
s/^Jan /2016\/01\//
s/^Feb /2016\/02\//
s/^Mar /2016\/03\//
s/^Apr /2016\/04\//
s/^May /2016\/05\//
s/^Jun /2016\/06\//
s/^Jul /2016\/07\//
s/^Aug /2016\/08\//
s/^Sep /2016\/09\//
s/^Oct /2016\/10\//
@tomhat
tomhat / record_postqueue_count.sh
Last active December 21, 2016 05:26
Count Postqueue Buffer
/bin/echo -n `/bin/date +"%Y/%m/%d %H:%M:%S"`" "
/usr/sbin/postqueue -p|/usr/bin/wc -l
@tomhat
tomhat / rename_mp4_m4a
Last active December 27, 2016 21:23
Rename mp4 to m4a (bash one liner shell)
for i in *.mp4; do mv "$i" "${i%.mp4}.m4a" ; done;