Skip to content

Instantly share code, notes, and snippets.

@alpody
alpody / gist:1e64ce3304e3f1719f65419561446edd
Last active June 20, 2016 06:44
Find file with bom and remove BOM from the files
grep -rl $'\xEF\xBB\xBF'
# remove file with bom
# if remove .bak then sed not create backup
find . -type f -exec sed '1s/^\xEF\xBB\xBF//' -i.bak {} \; -exec rm {}.bak \;
@alpody
alpody / gist:02bd5289470f0352f8caf48d250571a2
Created April 21, 2016 10:00
find files with date range and archive it
find ./2016 -newermt '2016-03-01' ! -newermt '2016-03-31' | xargs tar -czvf march-jpg.tar.gz
@alpody
alpody / excel_macros
Last active December 5, 2015 16:37
remove line break form excell cell
Sub ReplaceNextLine()
Selection.Replace What:=Chr(10), Replacement:=" "
End Sub
@alpody
alpody / opendata-dir-stat
Created November 20, 2015 09:45
Statistics for opendata dir from access log
grep -o '/opendata\S*.*200.*' access_log | grep -o '/opendata\S*' | sort | uniq -c | sort -nr |less
@alpody
alpody / diff
Last active November 17, 2015 08:23
Remove file what name not exist in dir-site.txt
diff dir-site-id.txt site-id.txt | sed -n '/>/s/>\s\(.*\)/\1/p' | xargs -I {} rm res/{}
@alpody
alpody / testPrivateProtected.php
Last active October 24, 2015 16:41
unittest private method in php
// http://www.webtipblog.com/unit-testing-private-methods-and-properties-with-phpunit/
class Foo {
private $foobar;
private function bar( $number )
{
// keep me private!
}
}