This file contains hidden or 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/env groovy | |
| def items = [ '1' : [a : 1, b : 2], '2' : [a :1, b: 3], '3' : [a: 0, b :5]] | |
| def mx = items.findAll { k, v -> v.a == 1 }.max { it.value.b }.value.b | |
| println mx | |
| def mx1 = items.max { left, right -> | |
| if(left.value.a == 1 && right.value.a == 1) { | |
| left.value.b <=> right.value.b | |
| } else { |
This file contains hidden or 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
| textutil -convert html -stdout file.rtf | pandoc --from=html --to=markdown --out=file.md |
This file contains hidden or 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/env groovy | |
| @Grapes([ | |
| @Grab(group = 'com.h2database', module = 'h2', version = '1.4.194'), | |
| @GrabConfig(systemClassLoader=true) | |
| ]) | |
| import groovy.sql.Sql | |
| import org.h2.Driver |
This file contains hidden or 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
| ln -sfn /path/to/directory /target/linkname |
This file contains hidden or 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 will find files recursively (you can limit it by using some 'find' parameters. | |
| # see the man pages | |
| # Final backslash required for exec example to work | |
| find . -name '*.gz' -exec gunzip '{}' \; |
This file contains hidden or 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
| U#sing gunzip command: | |
| gunzip file.gz | |
| ls file | |
| #Using gzip -d command: | |
| gzip -d file.gz | |
| ls file | |
| #If file extension is tar.gz, type the command: | |
| tar -zxvf file.tar.gz |
This file contains hidden or 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
| tar -czvf name-of-archive.tar.gz /path/to/directory-or-file | |
| #Here’s what those switches actually mean: | |
| #-c: Create an archive. | |
| #-z: Compress the archive with gzip. | |
| #-v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful. | |
| #-f: Allows you to specify the filename of the archive. | |
| tar -czvf archive.tar.gz stuff | |
| tar -czvf archive.tar.gz /usr/local/something |
This file contains hidden or 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 | |
| PREV_FILE=unified_article_processing_outcomes.txt | |
| NEW_FILE=unified_article_processing_outcomes_new.txt | |
| echo Checking for updates... | |
| DIFF=$(diff $PREV_FILE $NEW_FILE) | |
| if [ $? -ne 0 ] | |
| then |
This file contains hidden or 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/env groovy | |
| def execute(command) { | |
| def proc = command.execute() | |
| def out = new StringBuffer() | |
| def err = new StringBuffer() | |
| proc.consumeProcessOutput(out, err) | |
| proc.waitFor() | |
| if( out.size() > 0 ) println out |
This file contains hidden or 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
| find . -name ".DS_Store" -type f -exec rm {} \; |