Skip to content

Instantly share code, notes, and snippets.

View marsyang1's full-sized avatar

marsyang1 marsyang1

  • Taichung,Taiwan
View GitHub Profile
@marsyang1
marsyang1 / Shippable.yml
Created June 27, 2017 02:00
test Shippable.yml
language: none
build:
pre_ci:
- gradle clean build
- docker build -t builder:tip .
pre_ci_boot:
- image_name: builder
image_tag: tip
@marsyang1
marsyang1 / debug.sh
Last active April 12, 2019 04:13
Linux debug log command
# show line number
cat --number logs/catalina.out
# grep with two pattern and
cat --number logs/catalina.out | grep -e 'pattern1.*pattern2' -e 'pattern2.*pattern1'
# cat by number
awk 'NR >= 57890000 && NR <= 57890010' logs/catalina.out
## docker daemon log....
# https://docs.docker.com/config/daemon/
journalctl -u docker.service -n 1000
journalctl -u docker.service -f
@marsyang1
marsyang1 / build.gradle
Last active May 25, 2017 09:19
Gradle for Eclipse Project Architecture Setting
/**
* reference https://stackoverflow.com/questions/18273184/how-to-set-webappdirname-in-gradle
* http://samchu.logdown.com/posts/243171-using-gradle-management-project-kit
*
*/
group 'com.mars'
version '1.0-SNAPSHOT'
apply plugin: 'war'
apply plugin: 'idea'
@marsyang1
marsyang1 / hibernateInnerJoin.java
Last active August 15, 2018 12:08
hibernate DetachedCriteria join
//http://stackoverflow.com/questions/13075390/hibernate-subquery-detachedcriteria
DetachedCriteria exampleSubquery = DetachedCriteria.forClass(MyPersistedObject.class)
.setProjection(Property.forName("id"))
// plus any other criteria...
;
Criteria criteria = getSession().createCriteria(ARelatedPersistedObject.class)
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
.add(Subqueries.propertyIn("myPersistedObjectId", exampleSubquery)));
// For multiple subqueries, you can use a boolean operator like Restrictions.or():
@marsyang1
marsyang1 / restart_template.sh
Last active May 5, 2017 03:48
Linux clean cache
if [ -z "${projectPathName}" ]; then
echo "ERROR: projectPathName IS NULL , Failed to START. Please recheck the variables"
exit 1 # terminate and indicate error
fi
echo "restarting $projectPathName ......."
projectPath="/home/webapp/$projectPathName"
echo "projectPath = $projectPath"
sudo sh -c 'echo 1 >/proc/sys/vm/drop_caches'
sudo sh -c 'echo 2 >/proc/sys/vm/drop_caches'
echo $projectPath
@marsyang1
marsyang1 / idea64.exe.vmoptions
Last active August 3, 2017 02:43
idea64.exe.vmoptions
-Xms2g
-Xmx8g
-XX:ReservedCodeCacheSize=512m
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=2000
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
@marsyang1
marsyang1 / ruby array
Created January 6, 2017 01:15
ruby array
PORT_RANGE = Array(10000..10010)
#.concat(Array(17000..17010)).concat(Array(18000..18010)).concat(Array(19000..19010))
#.concat(Array(17100..17110)).concat(Array(18100..18110)).concat(Array(19100..19110))
#.push(17050).push(18050).push(19050)
@marsyang1
marsyang1 / idea64.exe.vmoptions
Last active April 25, 2017 06:48
idea64.exe.vmoptions - big memory version
-Xms2g
-Xmx8g
-XX:ReservedCodeCacheSize=512m
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=200
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
@marsyang1
marsyang1 / moniter-docker-test-shell.sh
Last active December 7, 2016 05:05
moniter-docker-test-shell
docker run -d -p 10001:80 \
-v /home/vagrant/docker-workshop/icinga2_home/constants.conf:/etc/icinga2/constants.conf \
-v /home/vagrant/docker-workshop/icinga2_home/zones.conf:/etc/icinga2/zones.conf \
-v /home/vagrant/docker-workshop//icinga2_home/hosts.conf:/etc/icinga2/conf.d/hosts.conf \
icinga/icinga2
docker run -it -p 10000:9090 \
-v /home/vagrant/docker-workshop/prometheus_home/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus -config.file=/etc/prometheus/prometheus.yml -storage.local.path=/prometheus -storage.local.memory-chunks=10000
@marsyang1
marsyang1 / constants.conf
Last active January 6, 2017 02:27
docker icinga2 setting
/**
* This file defines global constants which can be used in
* the other configuration files.
*/
/* The directory which contains the plugins from the Monitoring Plugins project. */
const PluginDir = "/usr/lib64/nagios/plugins"
/* The directory which contains the Manubulon plugins.
* Check the documentation, chapter "SNMP Manubulon Plugin Check Commands", for details.