Skip to content

Instantly share code, notes, and snippets.

@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!
}
}
@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 / 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 / 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 / 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 / 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:0e604f6978601394a3e722560559df9a
Created June 20, 2016 14:55
Find "Word" in files and copy them to append and save directory structure
grep -rl 'Word' | cpio -pdm ./append
@alpody
alpody / gist:efa0f141bbc718af8f0f5a6179885cc7
Created October 18, 2016 07:03
Add line numbers to every line in vim
:%s/^/\=printf("%04d\t", line('.'))
@alpody
alpody / gist:27690be5312e589e3d2d561020de6667
Last active May 27, 2023 13:03
export all keybindings in vim to file
"verbose show file which produce remap keybinding
:redir! > vim_keys.txt
:silent verbose map
:redir END
when i try
docker swarm init --advertise-addr=192.168.56.105
I got message:
Error response from daemon: --live-restore daemon configuration is incompatible with swarm mode
I edit docker config
vi /etc/sysconfig/docker
and remove --live-restore options