execute the scripts http://jenkins-server/script
def jobName = "xb-nodetest"
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().each { it.delete() }
job.nextBuildNumber = 1
job.updateNextBuildNumber(1)
job.save()
| # split a file (sp500.csv) with 101 lines each with numeric suffixes and additional extension suffixes | |
| split --numeric-suffixes=1 -l 101 sp500.csv stock --additional-suffix=".csv"; ls stock*.csv | |
| # the output is as below | |
| stock01.csv stock02.csv stock03.csv stock04.csv stock05.csv | |
| # gnome graphical font size | |
| # fontsize 1.5 <-- to make it bigger | |
| # fontsize <-- to reset to normal | |
| # fontsize 0.7 <-- to make it smaller |
| #!/bin/bash | |
| # cleanup containers.json (remove tmp containers, sort them by name) | |
| # open command prompt in profiles directory and execute | |
| # only have the non-tmp containers | |
| jq '.' containers.json > c01.json | |
| jq '.identities |= map(select(.name | test("^tmp") | not)) | .identities |= sort_by(.name) | .' c01.json > containers.json | |
| # Construct the grep pattern with 'userContextId=' for each userContextId from JSON for just the tmp containers |
| # source this file and use the functions, download the jenkins-cli.jar first | |
| export JENKINS_SERVER=localhost | |
| export JENKINS_PORT=8080 | |
| export JENKINS_USER='admin' | |
| export JENKINS_PASS='admin' | |
| export JENKINS_PROTO='http' | |
| export JENKINS_JOBDIR="jenkins-jobs" | |
| jenkins_urlhelp() { | |
| echo "copy, change and paste for customization" |
def jobName = "xb-nodetest"
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().each { it.delete() }
job.nextBuildNumber = 1
job.updateNextBuildNumber(1)
job.save()
| # generate string list | |
| python3 -c 'import random,json,string; print([ "".join([random.choice(string.ascii_letters) for ix in range(15)]) for jx in range(10)])' | |
| # print one each line, logic is to create a list first and use print with * and separator | |
| python3 -c 'import random,string; sx = ["".join([random.choice(string.ascii_letters) for ix in range(15)]) for jx in range(10)]; print(*sx, sep="\n")' | |
| # generate a csv file, the one below generates a csv file with random people name and age, change the tuple to more than 2, you could create address | |
| python3 -c 'import random,string; ppl = [("".join(random.choice(string.ascii_letters) for ix in range(6)), random.randrange(20,90)) for jx in range(10)]; [print(f"{name}, {age}") for name, age in ppl]' | |
| # generate AWS account numbers, random 12 digit number, primarily used for testing |
| # create a volume, attach it, erase the disk, save the install app to it | |
| hdiutil create -o macos/Catalina -size 10g -volname Catalina -layout SPUD -fs HFS+J | |
| hdiutil attach macos/Catalina.dmg -noverify -mountpoint /Volumes/Catalina | |
| DISKNUM=$(df -h /Volumes/Catalina | tail -1 | cut -c6-10) | |
| diskutil eraseDisk JHFS+ Catalina ${DISKNUM} | |
| # now install the macos on to the mounted volume | |
| "/Applications/Install macOS Catalina.app/Contents/Resources/createinstallmedia" --volume /Volumes/Catalina/ --nointeraction | |
| # convert to img |
| #list all accounts | |
| aws organizations list-accounts | |
| #list all active accounts | |
| aws organizations list-accounts | jq -r '.Accounts[] | select(.Status == "ACTIVE") | "\(.Id) \(.Name)"' | |
| # create a key value pair of account number to name | |
| aws organizations list-accounts | jq -M '[.Accounts[] | select(.Status == "ACTIVE") | {(.Id): .Name}] | add | to_entries | sort_by(.key) | from_entries' | |
| #list all in-active accounts |
| cat "xml-file" | python3 -c 'import sys,xmltodict,yaml,json; print(yaml.dump(json.loads(json.dumps(xmltodict.parse(sys.stdin.read())))))' | |
| aws ec2 describe-vpn-connections | jq -r '.VpnConnections[].CustomerGatewayConfiguration' | python3 -c 'import sys,xmltodict,yaml,json; print(yaml.dump(json.loads(json.dumps(xmltodict.parse(sys.stdin.read())))))' |
| aws configservice --region us-west-1 describe-delivery-channels | |
| aws configservice --region us-west-2 describe-delivery-channels | |
| aws configservice --region us-east-1 describe-delivery-channels | |
| aws configservice --region us-east-2 describe-delivery-channels | |
| aws configservice --region us-west-1 delete-delivery-channel --delivery-channel-name default | |
| aws configservice --region us-west-2 delete-delivery-channel --delivery-channel-name default | |
| aws configservice --region us-east-1 delete-delivery-channel --delivery-channel-name default | |
| aws configservice --region us-east-2 delete-delivery-channel --delivery-channel-name default |
| aws ec2 describe-instances | jq -c '.Reservations[].Instances[] | { InstanceId: .InstanceId, IP:.PrivateIpAddress, State: .State.Name} ' | |
| aws ec2 describe-instances | jq -c '.Reservations[].Instances[] | [ .InstanceId, .PrivateIpAddress, .State.Name] ' | |
| aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId]' --filters Name=instance-state-name,Values=running --output text | |
| aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,PrivateIpAddress,State.Name]' --filters Name=instance-state-name,Values=running --output text | |
| aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query 'Reservations[*].Instances[*].[InstanceId,PrivateIpAddress]' --output text |