Skip to content

Instantly share code, notes, and snippets.

View gwsu2008's full-sized avatar

Guang gwsu2008

View GitHub Profile
@gwsu2008
gwsu2008 / _bash_utils_tips
Last active May 22, 2021 23:52
Useful Bash utils and tips
### Useful Bash command and tips ###
"""
Useful Python scripts and tips
"""
@gwsu2008
gwsu2008 / Job_loop_steps
Last active April 20, 2021 14:35
jenkins-groovy-scripts.cmd
job ("generated.job") {
readFileFromWorkspace('your_csv_file.csv').eachLine { line ->
line.split(',').each { value ->
steps {
shell ("echo 'running my shell ${value}'")
}
}
}
}
@gwsu2008
gwsu2008 / openssl-cmd.sh
Last active January 27, 2022 17:53
openssl-self-sign-cert
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pemcopy to clipboard
openssl x509 -text -noout -in certificate.pemcopy to clipboard
openssl pkcs12 -inkey key.pem -in certificate.pem -export -out certificate.p12copy to clipboard
openssl pkcs12 -in certificate.p12 -noout -info
openssl pkcs12 -in publicAndprivate.pfx -nocerts -out privateKey.pem
openssl pkcs12 -in publicAndprivate.pfx -clcerts -nokeys -out publicCert.pem
openssl rsa -in privateKey.pem -out private.pem
Run the following command to export the private key: openssl pkcs12 -in certname.pfx -nocerts -out key.pem -nodes
Run the following command to export the certificate: openssl pkcs12 -in certname.pfx -nokeys -out cert.pem
@gwsu2008
gwsu2008 / floatsign.sh
Created May 4, 2018 04:51
A small bash script to re-sign iOS applications.
# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
#
# Extended by Ronan O Ciosoig January 2012
#
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
@gwsu2008
gwsu2008 / jenkins_haproxy_config.cfg
Created April 15, 2018 22:24 — forked from xelwarto/jenkins_haproxy_config.cfg
Jenkins CI haproxy configuration example
global
chroot /var/lib/haproxy
crt-base /etc/pki/tls/certs
daemon
group haproxy
log 127.0.0.1 local0
maxconn 2000
pidfile /var/run/haproxy.pid
stats socket /var/lib/haproxy/stats
tune.ssl.default-dh-param 2048
@gwsu2008
gwsu2008 / adb-commands
Last active January 3, 2020 06:34
adb-commands
# List service
adb shell dumpsys -l
# Turn on bluetooth
adb shell service call bluetooth_manager 6
adb shell dumpsys bluetooth_manager
# Wake up device ${UDID} if the screen is off
adb -s ${UDID} shell dumpsys power | grep "Display Power: state=ON" | xargs -0 test -z && adb -s ${UDID} shell input keyevent 26
@gwsu2008
gwsu2008 / mac-os-tips.sh
Last active June 12, 2020 09:04
mac-os-tips.sh
# update entitlement and query entitlement and query provisioning profile
/usr/libexec/PlistBuddy -c 'Set :signingStyle manual' exportOptions.plist
/usr/libexec/PlistBuddy -c 'Add :signingStyle string manual' exportOptions.plist
/usr/libexec/PlistBuddy -c "Delete :provisioningProfiles" exportOptions.plist
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles:com.proteus.apps.proteus-mobile-gsu string fsdffsaf-sdf-Distribution-dsfads" exportOptions.plist
codesign -d --entitlements - "Payload/my.app/"
security cms -D -i "Payload/my.app/embedded.mobileprovision"
@gwsu2008
gwsu2008 / maven-tips.sh
Last active March 12, 2018 16:33
maven-tips.sh
# Getting project version from pom.xml and save the version to a file
mvn com.smartcodeltd:release-candidate-maven-plugin:LATEST:version \
-DoutputTemplate="PROJECT_VERSION={{ version }}" \
-DoutputUri="file://\${project.basedir}/version.properties"
#Print project version
mvn -q -N org.codehaus.mojo:exec-maven-plugin:1.3.1:exec \
-Dexec.executable='echo' \
-Dexec.args='${project.version}'
@gwsu2008
gwsu2008 / x11vnc-xinet-config
Created February 24, 2018 16:35
x11vnc-xinet-config
/etc/xinetd.d/x11vnc
service x11vnc
{
port = 5900
type = UNLISTED
socket_type = stream
protocol = tcp
wait = no
user = jenkins
server = /usr/bin/x11vnc