-
To list all the software/lib installed by brew
$ brew list
-
to update an app
$ brew upgrade appname
-
to see issues
$ brew doctor
-
to update brew
$ brew update
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
def m = "1234 abc" =~ /^(\d+)/ | |
def n = "abc 1234" =~ /^(\d+)/ | |
println (m.find()?m.group():"not matched") | |
println (n.find()?n.group():"not matched") | |
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
_BUCKET_NAME="foo.example.com" | |
_POLICY=$(cat <<EOT | |
{ | |
"Version":"2012-10-17", | |
"Statement":[{ | |
"Sid":"PublicReadForGetBucketObjects", | |
"Effect":"Allow", | |
"Principal": "*", | |
"Action":["s3:GetObject"], |
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
def (a,b,rest) = [0, 1, 2..-1].collect { [1,2,3,4][it] } | |
assert a == 1 | |
assert b == 2 | |
assert rest == [3,4] |
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
// saving from url to a file (append) | |
new File("output.xml") << new URL ("http://some.url/some/path.xml").getText() |
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
new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC")) |
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
log4j.rootLogger=INFO, CONSOLE | |
# CONSOLE is set to be a ConsoleAppender using a PatternLayout | |
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender | |
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout | |
log4j.appender.CONSOLE.layout.ConversionPattern=[%-5p] %m%n | |
# a more detailed PatternLayout: %d [%t] %-5p %c - %m%n | |
# adjust specific logger levels as per the need to control the verbosity of logs |
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
import groovy.io.FileType | |
import groovy.io.FileVisitResult | |
final excludedDirs = ['.svn', '.git', '.hg', '.idea', 'node_modules', '.gradle', 'build'] | |
int count = 0 | |
new File(root).traverse( | |
type : FileType.DIRECTORIES, | |
preDir : { if (it.name in excludedDirs) return FileVisitResult.SKIP_SUBTREE }, // excludes children of excluded dirs | |
excludeNameFilter : { it in excludedDirs }, // excludes the excluded dirs as well |
- Take backup of old keychain : http://osxdaily.com/2012/07/05/copy-keychain-login-passwords-between-macs/
- Backup /etc/hosts /etc/hostconfig
- copy .zshrc, bashrc, gitconfig etc If you don't already have dotfiles project
- export chrome/firefox/safari bookmarks, bookmarks-toolbars
- export idea/rubymine mine settings : http://www.jetbrains.com/idea/webhelp/exporting-and-importing-settings.html
- Also see: https://intellij-support.jetbrains.com/entries/23358108
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
println """ | |
some "text" with quotes | |
""".replaceAll (/\"/,/\\\"/) |
NewerOlder