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
grep --include="*.php" -l -R table_name . | xargs egrep -l -i "insert|update|delete" |
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
db.tag_ru.aggregate({ $unwind: '$items'}, { $match: { "items.type":"news"}}, { $group: {_id: '$_id', count: {$sum: 1}}}, {$group: {_id:null, cnt:{$sum:"$count"} } } ) |
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
myres = db.tag_ru.aggregate( | |
{ $match: {_id: 1354987}}, | |
{ $unwind: '$items'}, | |
{ $match: {'items.type': "news"}}, | |
{ $group: {_id: '$_id', items: {$sum: '$items'}}}) | |
myres.result[0].items.length |
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
svnci() { | |
greprc=$(svn diff | grep -wc -E '(echo|var_dump|print_r|var_export)') | |
if [[ $greprc == 1 ]] ; then | |
echo '###############################' | |
echo '### WARNING! DEBUG DETECTED ###' | |
echo '###############################' | |
svn diff | grep -E '(echo|var_dump|print_r|var_export|\+\+\+)' | |
else | |
if [[ $greprc == 0 ]] ; then |
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
#! /bin/bash | |
# path to project dir | |
base_path=/home/username/apps/android_template/ | |
# path to main app project | |
proj_path=${base_path}MainActivity/ | |
# path to res dir | |
res_path=${proj_path}res/ | |
# path to dir with images for all necessary branches | |
img_path=/home/username/apps/images/ |
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
#!/bin/bash | |
# list all branches | |
git for-each-ref --format='%(refname:short)' refs/heads | | |
while read branch; do | |
# if [[ $branch == ru_template32 ]]; then | |
# exit 0 | |
# fi | |
echo $branch | |
git checkout $branch |
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
#!/bin/bash | |
find . -type f -printf '%p\n' | while read file; do | |
oldfile=$(basename "$file") | |
newfile=$(echo "$oldfile" | sed 's/OLDNAME.jpg/NEWNAME.jpg/g') | |
if [ ! "$newfile" == "$oldfile" ]; then | |
mv "$file" "${file%$oldfile}$newfile" | |
fi | |
done |
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 diff --no-prefix > patchfile | |
then apply the patch: | |
patch -p0 < patchfile | |
If you have an existing "git diff" patch file that was created without the "--no-prefix" option, you can apply that patch via: | |
patch -p1 < patchfile | |
this will ignore the default a/ b/ source prefixes. |
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
#!/bin/bash | |
for PROJECT in Proj1 Proj2 | |
do | |
echo "##############" | |
echo "Starting ${PROJECT} update..." | |
cd /home/username/httpdocs/services/projects/${PROJECT} | |
expect <<- DONE | |
spawn svn up | |
expect { |
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
#!/usr/bin/expect | |
spawn svn up | |
expect { | |
"[email protected]'s password:*" { | |
send -- "password\r" | |
exp_continue | |
} | |
eof { | |
exit 0} |
NewerOlder