Error loading source code.
Month: November 2017
Shortcuts and Cheat sheets
Bash Scripting Cheat Sheet
Emacs Edit Mode Keyboard Shortcuts
http://www.catonmat.net/download/readline-emacs-editing-mode-cheat-sheet.pdf
Emmet Cheat Sheet
http://docs.emmet.io/cheat-sheet/
IntelliJ Keyboard Shortcuts
https://www.jetbrains.com/help/idea/keyboard-shortcuts-by-category.html
https://www.jetbrains.com/help/idea/keyboard-shortcuts-by-keystroke.html
https://www.jetbrains.com/help/idea/adding-deleting-and-moving-code-elements.html
https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html
Mac Keyboard Shortcuts
https://support.apple.com/en-us/HT201236
Markdown Cheat Sheet
https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf
https://daringfireball.net/projects/markdown/basics
Scala Cheat Sheet
http://docs.scala-lang.org/cheatsheets/index.html
Vim Cheat Sheet
Subversion
Basic
1 2 3 4 5 6 7 8 9 10 11 |
# Creating a patch file svn diff > ~/my.diff # Applying a patch file patch -p0 -i ~/my.diff # View Last 5 commits svn log -l5 -v # Revert to revision svn up -r 10 |
Changelist
1 |
# TODO |
References
SSH, SCP, SFTP
SSH (Secure Shell)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# Using current username and default port 22 ssh myserver # Using provided username ssh myusername@myserver # Using provided username and provided port ssh -p myport myusername@myserver # Connect to server, execute command, and disconnect ssh myusername@myserver mycommand # Execute command with argument, notice single quotes to wrap ssh myusername@myserver 'mycommand "argument text with spaces"' |
SCP (Secure Copy Protocol)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# Copy file from local to remote scp /path/to/localfile myusername@myserver:/path/to/remotefileorfolder # Copy file from remote to local scp myusername@myserver:/path/to/remotefile /path/to/localfileorfolder # Copy file from remote to remote (servers have to be able to communicate) scp myusername@myserver1:/path/to/remotefile myusername@myserver2:/path/to/remotefileorfolder # Specifying a port (notice uppercase -P vs SSH) scp -P myport /path/to/localfile myusername@myserver:/path/to/remotefileorfolder # Copy multiple files to local directory using asterix scp myusername@myserver:/path/to/* . # Copy directory and content with recursive flag scp -r myusername@myserver:/path/to/remotefolder . # Limit bandwidth, measured in Kbit/sec scp -l mybandwidthlimit myusername@myserver:/path/to/* . |
SFTP (Secure FTP)
1 2 3 4 5 6 7 8 9 10 11 |
# Connect to server sftp myserver # Upload local file put path/to/localfile [/path/to/remotefileorfolder] # Download local file get path/to/remotefile [/path/to/localfileorfolder] # Download in one go, not for uploads sftp myusername@myserver:/path/to/remotefile [/path/to/localfileorfolder] |
References and Resources
Bash Keyboard Shortcuts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
CTRL L = Clear the terminal #### Navigation CTRL A = Cursor to start of line CTRL E = Cursor the end of line CTRL F = Forward one char CTRL B = Back one char ALT F = Forward one word ALT B = Back one word Ctrl p = Previous command (Up arrow) Ctrl n = Next command (Down arrow) #### Manipulate ALT U = Uppercase right word ALT L = Lowercase right word ALT C = Init Cap next word ALT T = Swap current word with previous CTRL T = Swap character under cursor with the previous one #### Delete CTRL U = Delete left CTRL K = Delete right CTRL W or ALT DEL = Delete word on the left ALT D = Delete to the end of word CTRL D = delete character under the cursor CTRL H = delete character before the cursor CTRL Y = Paste (after CTRL U,K or W) ALT Y = Loop through previously cut text (after CTRL Y) ALT . = Loop through and paste last argument of previous commands. !! = repeat last command !abc = Run last command starting with abc !abc:p = Print last command starting with abc !$ = Print last argument of previous command !* = Print all arguments of previous command ALT + . Retrive last argument of previous command ^abc^def Run previous command, replacing abc with def CTRL - = Undo CTRL R = reverse search history (repeat to loop through results) CTRL R x 2 = Search the last remembered search term CTRL G = Escape from history searching mode CTRL XX = Toggle between the start of line and current cursor position CTRL XX = Move between end of line and current cursor position (and back again) CTRL L = Clear screen |
Bootstrapping with Gradle
Bootstrap options
1 2 3 4 5 6 7 |
gradle init --type pom gradle init --type java-application [--test-framework spock | testng] gradle init --type java-library [--test-framework spock | testng] gradle init --type scala-library gradle init --type groovy-library gradle init --type groovy-application gradle init --type basic |
Gradle Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# create app mkdir lidenlab-app && cd lidenlab-app # bootstrap java project gradle init --type java-application # build project (runs unit tests) ./gradlew build # check the test results build/reports/tests/test/index.html # list available Gradle tasks ./gradlew tasks # execute main ./gradlew run # delete app cd .. && rm -rf lidenlab-app |
Common Config (in progress)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
apply plugin: 'java' apply plugin: 'application' // specify Java version sourceCompatibility = 1.8 targetCompatibility = 1.8 // for gradle run mainClassName = "com.lidenlab.App" repositories { //mavenCentral() jcenter() } dependencies { compile "groupId:artifactId:version" testCompile group: 'junit', name: 'junit', version: '4.12' } |
Create runnable Jar file
Configure the Jar task of the Java plugin:
1 2 3 4 5 6 7 |
apply plugin: 'java' jar { manifest { attributes 'Main-Class': 'com.lidenlab.App' } } |
Force running subsequent tests
1 2 3 4 5 6 7 8 9 10 11 |
# use the rerun flag gradle test --rerun-tasks # clean the tests gradle cleanTest test # configure test to depend on cleanTest in build.gradle test { dependsOn 'cleanTest' //Your previous task details (if any) } |
Show StandardStreams from tests
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// show System.out.println and System.err.println test { testLogging { showStandardStreams = true // events method: // events 'STANDARD_OUT', 'STANDARD_ERROR' // events method with enum values: // events org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT, // org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR, // Or set events property: // events = ['STANDARD_OUT', 'STANDARD_ERROR'] } } |
See: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.logging.TestLoggingContainer.html
References and Resources
- https://docs.gradle.org/current/userguide/userguide.html
- https://docs.gradle.org/current/userguide/gradle_command_line.html
- https://docs.gradle.org/current/userguide/build_init_plugin.html
- https://docs.gradle.org/current/userguide/application_plugin.html
- https://docs.gradle.org/current/userguide/java_plugin.html
- https://github.com/johnrengelman/shadow