Thursday, September 12, 2013

weblog; saving my neck with git-reflog and namespace conflicts

Bash

bash - how to represent multiple conditions in shell script? - Stack Overflow

http://stackoverflow.com/questions/3826425/how-to-represent-multiple-conditions-in-shell-script
if [[ ( $g == 1 && $c == 123 ) || ( $g == 2 && $c == 456 ) ]]

Only process the file entries with 'webapp-idm' and 'webapp' in their name.

if [[ ( $cp =~ "webapp-idm" ) || ( $cp =~ "webapp" ) ]]
then
echo "processing $cp"
fi

bash - how to loop list of file names returned by find - Stack Overflow

http://stackoverflow.com/questions/9612090/how-to-loop-list-of-file-names-returned-by-find
for i in $(find -name \*.iso); do
    process "$i"
done

Loop for all .classpath files found recursively from the current directory.

for cp in $(find . -name ".classpath")
do
echo $cp
done

Other Comparison Operators

http://tldp.org/LDP/abs/html/comparison-ops.html
-eq

    is equal to

    if [ "$a" -eq "$b" ]

regex - use regular expression in if-condition in bash - Stack Overflow

http://stackoverflow.com/questions/2348379/use-regular-expression-in-if-condition-in-bash
$ for file in *; do [[ $file =~ "..g" ]] && echo $file ; done
abg
degree
..g

Java

XmlType (Java EE 5 SDK)

http://docs.oracle.com/javaee/5/api/javax/xml/bind/annotation/XmlType.html#name%28%29

When processing WSDLs and XSDs to generate Java code, node name clashes could be a problem.

Git

git ready » reflog, your safety net

http://gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html http://stackoverflow.com/questions/4786972/list-of-all-git-commits
git reflog

Pack up / clean up your repository (beware!)

# git reflog expire --expire=1.minute refs/heads/master
# git fsck --unreachable      
# git prune                   
# git gc                      

...you can use it as a safety net: you shouldn’t be worried that a merge, rebase, or some other action will destroy your work since you can find it again using this command.

http://gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html

No comments:

Post a Comment