Thursday, December 9, 2010

General Cheatsheet

CRON

minute (0-59)
| hour(0-23)
| | day of month (1-31)
| | | month (1-12)
| | | | day of week (0-6) 0==Sunday
| | | | | command
| | | | | |
* * * * * /your/command/here.sh > /dev/null 2>&1


.bash_profile

addalias() { echo "alias $1='$2' " >> ~/.bash_profile; . ~/.bash_profile; }
alias 'll=ls -la | less -r'
alias 'unixtime=date +%s'

CLICOLOR=1
LSCOLORS=GxFxCxDxBxegedabagaced
PS1=\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[00m\]\$

Extracting an XPath value in 2 lines of code:
        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder()
                .parse(new File("file.xml"));
        String myString = (String)XPathFactory.newInstance().newXPath()
                .compile("/rootelement/subelement/text()")
                .evaluate(doc, XPathConstants.STRING);

copy between S3 buckets:
aws --profile examplecap s3 sync s3://examplecap s3://examplecap-target --exclude "*" --include "*.geojson" --metadata-directive REPLACE --content-type "application/json" --cache-control "max-age=60"

No comments: