Skip to content

Instantly share code, notes, and snippets.

View gwsu2008's full-sized avatar

Guang gwsu2008

View GitHub Profile
@gwsu2008
gwsu2008 / java-selection
Created January 31, 2020 21:16
MacOS Java Selection
List java version:
/usr/libexec/java_home -V
Matching Java Virtual Machines (3):
11.0.6, x86_64: "AdoptOpenJDK (OpenJ9) 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11-openj9.jdk/Contents/Home
11.0.5, x86_64: "Java SE 11.0.5" /Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home
1.8.0_231, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home
Choose version in ~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0_231)
@gwsu2008
gwsu2008 / linux-screen.sh
Last active August 18, 2021 16:03
linux-screen.sh
#!/bin/bash +x
# terminate a screen session
screen -S [session id # you want to kill] -X kill
screen -S [session id # you want to kill] -X quit
# start screen session
/usr/bin/screen -d -m -S android_emu ./emulator -avd ${DEVICE_NAME} -gpu host -wipe-data -no-boot-anim -no-audio -noaudio -netfast -timezone America/Los_Angeles >> emulator.log 2>&1
@gwsu2008
gwsu2008 / MacOS docker daemon
Created January 31, 2020 17:46
MacOS docker daemon
Run:
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 2376:2375 bobrik/socat TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock
or
socat -d TCP-LISTEN:2376,range=127.0.0.1/32,reuseaddr,fork UNIX:/var/run/docker.sock
Using HTTP
https://docs.docker.com/engine/security/https/#connecting-to-the-secure-docker-port-using-curl
https://blog.couchbase.com/enabling-docker-remote-api-docker-machine-mac-osx/
@gwsu2008
gwsu2008 / jenkins-declarative-pipeline-tips.groovy
Created January 29, 2020 19:17
jenkins-declarative-pipeline-tips
pipeline {
stages {
stage("Build"){
steps {
script {
currentBuild.displayName = "The name."
currentBuild.description = "The best description."
}
}
}
@gwsu2008
gwsu2008 / useful_tips.groovy
Last active January 27, 2020 03:40
Groovy_Tips
// Check if key exists in map
def mymap = [name:"Gromit", likes:"cheese", id:1234]
def key = "likes"
if(mymap[key]) {
println mymap[key]
}
if(mymap.containsKey(key)) {
println mymap[key]
@gwsu2008
gwsu2008 / Jenkins-Pipeline-Info
Created January 25, 2020 15:13
Jenkins-PipeLine-Info
The simple answer is, Agent is for declarative pipelines and node is for scripted pipelines.
In declarative pipelines the agent directive is used for specifying which agent/slave the job/task is to be executed on. This directive only allows you to specify where the task is to be executed, which agent, slave, label or docker image.
On the other hand, in scripted pipelines the node step can be used for executing a script/step on a specific agent, label, slave. The node step optionally takes the agent or label name and then a closure with code that is to be executed on that node.
declarative and scripted pipelines (edit based on the comment):
* declarative pipelines is a new extension of the pipeline DSL (it is basically a pipeline script with only one step, a pipeline step with arguments (called directives), these directives should follow a specific syntax. The point of this new format is that it is more strict and therefore should be easier for those new to pipelines, allow for graphical editing and much m
@gwsu2008
gwsu2008 / Useful Sites
Last active January 25, 2020 04:10
Useful Sites
https://www.worldtimebuddy.com/?pl=1&lid=100,5392263,1819729,30&h=100
https://www.gardenista.com/posts/everything-you-need-to-know-about-zz-plants-zamioculcas-zamiifolia/
https://cleanvehiclerebate.org/eng/pre-post-purchase/1999
https://shop.thatgrin.com/slipstreamtm-no-drill-no-adhesive-front-license-plate-mounting-bracket-for-tesla-model-3.html
https://www.dmv.ca.gov/portal/dmv/detail/vr/decal
https://www.rapidtables.com/web/color/html-color-codes.html
https://myhellorewards.redlion.com/MyStays
https://rtyley.github.io/bfg-repo-cleaner/
https://ibotpeaches.github.io/Apktool/
https://raw.githubusercontent.com/apkudo/adbusbini/master/adb_usb.ini
@gwsu2008
gwsu2008 / Jenkins-plugins
Last active January 22, 2020 06:46
Jenkins-plugins
https://plugins.jenkins.io/convert-to-pipeline
https://github.com/KostyaSha/github-integration-plugin
https://plugins.jenkins.io/kubernetes
http://afonsof.com/jenkins-material-theme/
@gwsu2008
gwsu2008 / jenkins-docker.sh
Last active January 24, 2020 06:12
jenkins-docker.sh
# https://github.com/jenkinsci/docker/blob/master/README.md
docker run --name jenkins -d -p 8080:8080 -p 50000:50000 -u $(id -u ${USER}):$(id -g ${USER}) \
-v /Users/home/jenkins_home:/var/jenkins_home jenkins/jenkins:lts-jdk11
@gwsu2008
gwsu2008 / docker-commands.sh
Last active March 2, 2023 16:54
docker-commands
#!/bin/bash +x
* Run the container
docker run -it -e VAR=1 ubuntu_bash -d ashok/pyashokproj /bin/bash
* To start an existing container which is stopped
docker start <container-name/ID>
* To stop a running container
docker stop <container-name/ID>