Skip to content

Instantly share code, notes, and snippets.

View mengjiann's full-sized avatar
🤔
code. code.

MJ mengjiann

🤔
code. code.
  • Illumina
  • Singapore
View GitHub Profile
@mengjiann
mengjiann / gist:cce8fee0bb5b443e8875853fc7e8ae08
Created March 27, 2018 14:22
spring-boot-cloud-feign-config
@Configuration
public class FeignClientConfig {
@Bean
Logger.Level feignLoggerLevel() {
return Logger.Level.FULL;
}
@Bean
public RequestInterceptor requestInterceptor(){
Expression Utility Objects
Besides these basic objects, Thymeleaf will offer us a set of utility objects that will help us perform common tasks in our expressions.
#dates: utility methods for java.util.Date objects: formatting, component extraction, etc.
#calendars: analogous to #dates, but for java.util.Calendar objects.
#numbers: utility methods for formatting numeric objects.
#strings: utility methods for String objects: contains, startsWith, prepending/appending, etc.
#objects: utility methods for objects in general.
#bools: utility methods for boolean evaluation.
#arrays: utility methods for arrays.
- .ignore
- lombok
- alibaba coding guidelines
- gsonformat
- maven helper
- rainbow brackets
References: https://www.jianshu.com/p/686ba0ae4ac2
@mengjiann
mengjiann / gitcom.md
Created December 5, 2018 16:33 — forked from jednano/gitcom.md
Common git commands in a day-to-day workflow

Git Cheat Sheet

Initial Setup

Create an empty git repo or reinitialize an existing one

$ git init
# Spring cli init
spring init --artifactId demo --groupId com.mj --name demo --package-name com.mj.demo --dependencies web,lombok
# Maven quick start
mvn archetype:generate -DgroupId=com.mj -DartifactId=demo -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
# Get grep output from kubectl get pod and run with command
kgp | grep nginx | awk '{print $1 " sh"}' | xargs -o kubectl exec -it
# Docker related
@mengjiann
mengjiann / .zshrc
Last active April 7, 2019 07:21
my .zshrc
plugins=(
git docker docker-compose mvn tmux kubectl zsh-autosuggestions
)
# Pretty Json
alias pjson="python -m json.tool"
# Bind key
bindkey "\e\e[D" backward-word
bindkey "\e\e[C" forward-word
@mengjiann
mengjiann / gist:eec093d884cd402f48785a01de1a8bd7
Created March 24, 2019 07:40
Terminate Spring boot application
SpringApplication springApplication = new SpringApplicationBuilder()
.sources(<class name>.class).web(false).build();
springApplication.run(args).close();
Under normal mode
- daw - delete a word
- caw - delete a word and enter into edit mode.
Navigate
- b - previous word
- w - next word
- Ctrl+b - previous page
- Ctrl+f - next page
@mengjiann
mengjiann / gist:5fed0cbdadc79b4a187cb5f8755a3995
Created April 2, 2019 16:18
Restricting AWS S3 Bucket Access from Defined IP Address
{
"Version": "2012-10-17",
"Id": "S3PolicyIPRestrict",
"Statement": [
{
"Sid": "IPAllow",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
# stop the ecs agent
sudo stop ecs
# remove exited container
docker ps -qa --filter "status=exited" | xargs docker rm
# prune unused docker volume
docker volume prune
# stop the ecs agent