Skip to content

Instantly share code, notes, and snippets.

View lovejavaee's full-sized avatar
👋
Java | C++ | Python | ML | DL

Jeff M lovejavaee

👋
Java | C++ | Python | ML | DL
View GitHub Profile
By default surefire configuration includes tests matching "/Test*.java", "/_Test.java" or "/_TestCase.java" pattern.
By default failsafe configuration includes tests matching "/IT*.java", "/_IT.java" or "/_ITCase.java" pattern.
Usage:
mvn install -DskipUTs : Skips Unit tests
mvn install -DskipITs : Skips Integration tests
mvn install -DskipTests : Skips both Unit and Integration Tests
@lovejavaee
lovejavaee / git-hist.sh
Created February 13, 2018 07:18
git-hist.sh
##
# Creates an alias called "git hist" that outputs a nicely formatted git log.
# Usage is just like "git log"
# Examples:
# git hist
# git hist -5
# git hist <branch_name>
# git hist <tag_name> -10
##
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
_____________________________________
## General rules
1. Follow standard conventions.
2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
3. Boy scout rule. Leave the campground cleaner than you found it.
4. Always find root cause. Always look for the root cause of a problem.
## Design rules
@lovejavaee
lovejavaee / CacheConfig.java
Last active March 8, 2018 09:33
Guava cache with spring boot and clear cache method
import com.google.common.cache.CacheBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.guava.GuavaCache;
import org.springframework.cache.interceptor.CacheErrorHandler;
import org.springframework.cache.interceptor.CacheResolver;
import org.springframework.cache.interceptor.KeyGenerator;
https://raw.githubusercontent.com/wso2/code-quality-tools/master/checkstyle/checkstyle.xml
After installing it, Restart the IDEA. Then go to File -> Settings -> Other Settings -> Checkstyle. Click positive mark to add a new configuration file. Select “Check style file accessible via HTTP” option and add https://raw.githubusercontent.com/wso2/code-quality-tools/master/checkstyle/checkstyle.xml URL.
-Xmx10g
m2.xlarge (4 virtual cores)
Both Jetty and Netty execute the same code--generate 8k of random bits and compute a sha1, returning it over the wire.
INTERNAL (Benchmark tool runs on same machine)
--------
Jetty:
---------------------------------------------------------------
Jetty (NIO); version: 8.1.7.v20120910
---------------------------------------------------------------
Server Software: Jetty(8.1.7.v20120910)
Server Hostname: localhost
Server Port: 8989
Document Path: http://localhost:8989/rnd?c=2048
Document Length: 2048 bytes
$ sudo wget -qO- https://toolbelt.heroku.com/install.sh | sh
$ echo 'PATH="/usr/local/heroku/bin:$PATH"' >> .bash_profile
$ source .bash_profile
$ heroku version
$ heroku login
Enter your Heroku credentials.
Email: メールアドレス
Password (typing will be hidden): パスワード
git stash # Stash changes if any
git symbolic-ref HEAD refs/heads/${NEW_BRANCH} # Change head to a new, non-existing ref
git rm -rf . # Delete files from version control and working directory
rm -r . # Delete files from file system
git commit -m "Created new branch ${NEW_BRANCH}" # Commit changes in the new branch
@lovejavaee
lovejavaee / gist:84bafbd4c6e87418718ab63029dc4e33
Created June 6, 2018 16:11 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2: