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
# array of files to be compared to | |
$sources = array('/some/path/to/files', '/some/single/file.txt'); | |
# the compared file | |
$filename = '/the/file/that/should/be/newer.txt'; | |
# run find to check for newer files | |
$cmd = \Foomo\CliCall\Find::create($sources)->type('f')->newer($filename)->execute(); | |
if (empty($cmd->stdOut)) { | |
\trigger_error('$filename is newer than the other files'); | |
} else { | |
\trigger_error('some files are newer than $filename'); |
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
# @see http://www.viget.com/extend/effectively-using-git-with-subversion/ | |
git-svn clone -s http://example.com/my_subversion_repo local_dir | |
git-svn show-ignore > .gitignore |
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 & remove files which modification date is older than 3*24 hours | |
\Foomo\CliCall\Find::create('/path/to/folder')-type('f')->mtime('+3')->delete()->execute(); | |
# remove empty folders | |
\Foomo\CliCall\Find::create('/path/to/folder')-type('d')->addEmpty()->delete()->execute(); |
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
# Add a group for sftp only | |
$ addgroup sftponly | |
# Add a new user | |
# Note: We are using public key authentification, so leave the password blank | |
$ adduser USERNAME | |
# Add the user to the sftp only group | |
$ adduser USERNAME sftponly |
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
$ git filter-branch -f --tree-filter 'rm -rf <file>' HEAD |
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 . -type d -exec chmod g+s {} \; |
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
# move into correct folder | |
$ cd /path/to/base/dir | |
# apply patch with dry run | |
$ patch -p0 < PATCH_FILE.txt --dry-run | |
# apply patch | |
$ patch -p0 < PATCH_FILE.txt | |
# for more info |
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
$ ssh -R 9000:localhost:9000 you@server.com |