Skip to content

Instantly share code, notes, and snippets.

View gwsu2008's full-sized avatar

Guang gwsu2008

View GitHub Profile
@gwsu2008
gwsu2008 / python-date-quarterly.py
Created December 15, 2018 00:28
python-date-quarterly.py
mport pandas as pd
from datetime import datetime
No_of_quarters=8
#today = datetime.date.today()
today = datetime(2019, 1, 11)
month = pd.Period(today, freq='M')
quarter = month.asfreq('Q-DEC')
print(type(quarter))
@gwsu2008
gwsu2008 / backup-jenkins-s3.sh
Created December 13, 2018 07:22
backup-jenkins-s3.sh
# Delete all files in the workspace
rm -rf *
# Create a directory for the job definitions
mkdir -p $BUILD_ID/jobs
# Copy global configuration files into the workspace
cp $JENKINS_HOME/*.xml $BUILD_ID/
# Copy keys and secrets into the workspace
@gwsu2008
gwsu2008 / npm-list-global
Created December 5, 2018 21:20
npm-list-global
npm list -g --depth 0
@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
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_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(
@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 / 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 / README.md
Created July 28, 2018 00:21 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@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