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
2013-05-29 | |
Install required build tools: | |
# apt-get -y install git-core curl build-essential openssl libssl-dev python pkg-config checkinstall | |
Create node.js package (change the 0.10.8 to the current version): | |
# mkdir ~/nodejs && cd ~/nodejs | |
# wget -N http://nodejs.org/dist/node-latest.tar.gz | |
# mkdir node-install |
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
wget is a nice tool for downloading resources from the internet. The basic usage is wget url: | |
wget http://linuxreviews.org/ | |
Therefore, wget (manual page) + less (manual page) is all you need to surf the internet. The power of wget is that you may download sites recursive, meaning you also get all pages (and images and other data) linked on the front page: | |
wget -r http://linuxreviews.org/ | |
But many sites do not want you to download their entire site. To prevent this, they check how browsers identify. Many sites refuses you to connect or sends a blank page if they detect you are not using a web-browser. You might get a message like: |
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
cutycapt --url=http://www.cnn.com --out=cnn.com.svg | |
#supports multiple formats detected with file ext | |
#svg,ps,pdf,itext,html,rtree,png,jpeg,mng,tiff,gif,bmp,ppm,xbm,xpm |
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
Clean and Cannonical | |
http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/ |
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
//C# | |
string jStrObj = | |
"<?xml version='1.0' encoding='UTF-8'?><DataObject><id>ea9b96a6-1f8a-4563-9a15-b1ec0ea1bc34</id><name>blah</name><processed>false</processed></DataObject>"; | |
//to .net style property names | |
string camelPattern = @"(\<(?:[a-z])|\</(?:[a-z]))"; | |
jStrObj = Regex.Replace(jStrObj, camelPattern, m => m.Value.ToUpper()); | |
//to java style property names |
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
# Setup your log4j ConversionPattern to include a new ApplicationId field | |
log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{ApplicationId} | %m%n | |
# You can now set this value in your java code like this | |
private void setupLogging() { | |
org.apache.log4j.MDC.put("ApplicationId", "XZY321"); | |
} |
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
;3-state condition defined as a function | |
(define (3-state | |
value | |
positive-body | |
zero-body | |
negative-body) | |
(cond | |
((zero? value) zero-body) | |
((positive? value) positive-body) | |
(else negative-body))) |
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
;put this in your ~/.emacs file | |
;ref: http://community.schemewiki.org/?emacs-tutorial | |
;;; Always do syntax highlighting | |
(global-font-lock-mode 1) | |
;;; Also highlight parens | |
(setq show-paren-delay 0 | |
show-paren-style 'parenthesis) | |
(show-paren-mode 1) |
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
An extremely useful thing to know in emacs is how to discover what keys are bound to which commands on your own. | |
If you know the name of the command -- goto-line. If you type 'C-h w' (Control+h and then w), Emacs will as you "Where is command: ". Type goto-line and hit enter, and it will tell you what keystrokes (if any) are bound to that command. | |
There are a bunch more similar features. 'C-h k' does the inverse -- asks you for a keystroke and then tells you the command it runs; 'C-h b' shows all current keybindings; 'C-h a' will search for a string, so you might type 'C-h a goto' to search for commands with "goto" in the name; 'C-h v' describes variables; 'C-h f' describes functions; etc. |
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
This can help if you have problems with: brew update | |
Don't forget to fetch the origin!!! | |
$ cd /usr/local | |
$ git fetch origin | |
$ git reset --hard origin/master |