Find all the .php files in the current directory and below, and replace FROM with TO.
find . -type f -iname '*.php' -exec sed -i 's/FROM/TO/g' {} \;
Find all the .php files in the current directory and below, and replace FROM with TO.
find . -type f -iname '*.php' -exec sed -i 's/FROM/TO/g' {} \;
| # Edit using: | |
| # git config -e --global | |
| [user] | |
| name = Me | |
| email = [email protected] | |
| [alias] | |
| ap = add -p | |
| au = add -u | |
| bl = branch -l |
| -- Find the file ~/.kodi/userdata/MyVideosXX.db | |
| -- Open with sqlite3 | |
| -- Run the following statement: | |
| SELECT | |
| m.c00, -- Movie name | |
| p.strPath, -- Path | |
| f.strFilename -- File name | |
| FROM movie m |
| # All files, with grep | |
| find . -type f -exec cat {} \; | grep -v -E '^\s*(//|\*|\*/|/\*\*|$)' | wc -l | |
| # PHP Files, with awk. | |
| find . -iname '*.php' -type f -exec cat {} \; | awk '$0 !~ /^\s*(\/\/|\*|\*\/|\/\*\*|$)/{ print $0 }' | wc -l |
| <?php | |
| // Non-associative. | |
| $a = [1, 2, 3]; | |
| $b = [4, 5, 6, 7]; | |
| $c = $a + $b; | |
| var_dump($c); | |
| $d = array_merge($a, $b); |
| #!/bin/sh | |
| # Place this in /usr/local/bin | |
| # Run: chmod +x /usr/local/bin/st | |
| exec /opt/sublime_text/sublime_text "$@" |
| #!/bin/sh | |
| # Place in /usr/local/bin | |
| # Run: chmod +x /usr/loca/bin/phpx | |
| echo "<?php var_dump($@);" > /tmp/phpx.php | |
| php /tmp/phpx.php |
| # Add this file to ~/.local/share/mime/packages | |
| # Run: update-mime-database ~/.local/share/mime | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> | |
| <mime-type type="application/x-compressed-tar"> | |
| <glob pattern="*.mbz"/> | |
| </mime-type> | |
| </mime-info> |
| # Add this to .git/hooks/prepare-commit-msg | |
| # Then chmod +x .git/hooks/prepare-commit-msg | |
| # | |
| # /!\ Note, it is assumed that you have the alias `git cb` | |
| # which returns the current branch. | |
| if [ -z "$2" ]; then | |
| branch=`git cb` | |
| mdl=`expr match "$branch" 'MDL-\([0-9]\+\)-.*'` | |
| if [ -n "$mdl" ]; then |