Skip to content

Instantly share code, notes, and snippets.

View gwsu2008's full-sized avatar

Guang gwsu2008

View GitHub Profile
"""
Useful Python scripts and tips
"""
@gwsu2008
gwsu2008 / _bash_utils_tips
Last active May 22, 2021 23:52
Useful Bash utils and tips
### Useful Bash command and tips ###
@gwsu2008
gwsu2008 / _awk_tips
Last active July 14, 2018 19:21
AWS command tips
awk '{sub($1 FS,"" );print}' => remove 1st field and take the remaining.
awk '{print $NF}' => return last field
awk '{print ( $(NF-1) )}' => return 2nd to last field
@gwsu2008
gwsu2008 / README.md
Created July 28, 2018 00:21 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@gwsu2008
gwsu2008 / SQS-FIFO
Created July 31, 2018 04:18
_cloudformation
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"MyQueue": {
"Properties": {
"QueueName": "MyQueue.fifo",
"FifoQueue": true,
"ContentBasedDeduplication": true
},
"Type": "AWS::SQS::Queue"
@gwsu2008
gwsu2008 / resign.sh
Last active July 6, 2021 06:14
Resign IPA with new provisioning profile
rename ipa to zip and unzip it
rm -f embedded.mobileprovision and _CodeSign folder
cp ~/Library/MobileDevice/Profiles/DiscoverEntProdJul2019.mobileprovision Payload/App.app/embedded.mobileprovision
cd Payload
codesign -d --entitlements - *.app > entitlements.plist
cat entitlements.plist
cd ..
mv Payload/entitlements.plist .
codesign -f -s "iPhone Distribution: Company Cert" --entitlements entitlements.plist Payload/App.app
KEYCHAIN_PASSWD='xyz'
@gwsu2008
gwsu2008 / jenkins_store_credentials.groovy
Last active November 13, 2018 17:29
jenkins_store_credentials.groovy
secretText = new StringCredentialsImpl(
CredentialsScope.GLOBAL,
"secret-text",
"Secret Text Description",
Secret.fromString("some secret text goes here"))
file = new File("/path/to/some/file")
noFileItem = [ getName: { return "" } ] as FileItem
FileCredentailsImpl can take a file from a do
secretFile = new FileCredentialsImpl(
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import org.jenkinsci.plugins.plaincredentials.*
import org.jenkinsci.plugins.plaincredentials.impl.*
import hudson.util.Secret
import hudson.plugins.sshslaves.*
@gwsu2008
gwsu2008 / jenkins-import-job.sh
Last active December 12, 2018 17:54
jenkins-import-job.sh
curl -X POST 'https://<user>:<api-key>@jenkins_url/createItem?name=job_name' --header "Content-Type: application/xml" -d @config.xml
@gwsu2008
gwsu2008 / npm-list-global
Created December 5, 2018 21:20
npm-list-global
npm list -g --depth 0