Skip to content

Instantly share code, notes, and snippets.

View alexcheng1982's full-sized avatar
🎯
Focusing

Fu Cheng alexcheng1982

🎯
Focusing
View GitHub Profile
serviceMonitorSelector:
matchLabels:
release: prometheus-operator
@alexcheng1982
alexcheng1982 / service_monitor.yaml
Created June 9, 2019 23:08
Prometheus Operator ServiceMonitor for Spring Boot apps
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: my-service
labels:
release: prometheus-operator
spec:
selector:
matchLabels:
app: my-service
@alexcheng1982
alexcheng1982 / start-cassandra.sh
Created March 14, 2018 21:14
Start Cassandra
docker run --rm -p 7199:7199 -e "JMX_HOST=`ipconfig getifaddr en0`" alexcheng/cassandra
@alexcheng1982
alexcheng1982 / DefaultExceptionHandler.java
Created March 8, 2018 19:01
Spring MVC exception handler
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.WebRequest;
import java.util.Date;
@alexcheng1982
alexcheng1982 / tail-logs.config
Created March 8, 2018 19:00
Elastic Beanstalk log config
files:
"/opt/elasticbeanstalk/tasks/taillogs.d/my-app.conf" :
mode: "000644"
owner: webapp
group: webapp
content: |
/var/log/myapp.log
"/opt/elasticbeanstalk/tasks/bundlelogs.d/my-app.conf" :
mode: "000644"
owner: webapp
@alexcheng1982
alexcheng1982 / bitbucket-pipelines.yml
Created February 13, 2018 08:17
Bitbucket Pipelines
image:
name: <aws_account_id>.dkr.ecr.<region>.amazonaws.com/maven
aws:
access-key: $AWS_ACCESS_KEY
secret-key: $AWS_SECRET_KEY
pipelines:
default:
- step:
caches:
@alexcheng1982
alexcheng1982 / Dockerfile
Created February 13, 2018 08:16
Custom Maven Docker image
FROM maven:3.5.2-jdk-8-alpine
COPY settings.xml ${MAVEN_CONFIG}/
@alexcheng1982
alexcheng1982 / build.gradle
Created February 13, 2018 08:15
Gradle publish to Maven repository
buildscript {
repositories {
mavenCentral()
maven {
url "http://repository.jboss.org/nexus/content/groups/public/"
}
}
dependencies {
classpath 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
}
@alexcheng1982
alexcheng1982 / extract_7zip.yml
Created February 7, 2018 20:45
Extract tar.gz files using 7zip
- name: unzip tar.gz
win_command: "7z x {{ tar_gz_path }} -o{{ tar_path }} -y"
- name: unzip tar
win_command: "7z x {{ tar_path }} -o{{ extracted_path } -y"
@alexcheng1982
alexcheng1982 / install_7zip.yml
Created February 7, 2018 20:44
Install 7zip
- name: install 7zip
win_chocolatey:
name: 7zip
state: present