This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Environment variables | |
The git plugin sets several environment variables you can use in your scripts: | |
GIT_COMMIT - SHA of the current | |
GIT_BRANCH - Name of the remote repository (defaults to origin), followed by name of the branch currently being used, e.g. "origin/master" or "origin/foo" | |
GIT_LOCAL_BRANCH - Name of the branch on Jenkins. When the "checkout to specific local branch" behavior is configured, the variable is published. If the behavior is configured as null or **, the property will contain the resulting local branch name sans the remote name. | |
GIT_PREVIOUS_COMMIT - SHA of the previous built commit from the same branch (not set on first build on a branch) | |
GIT_PREVIOUS_SUCCESSFUL_COMMIT - SHA of the previous successfully built commit from the same branch (not set on first build on a branch) | |
GIT_URL - Repository remote URL | |
GIT_URL_N - Repository remote URLs when there are more than 1 remotes, e.g. GIT_URL_1, GIT_URL_2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -e causes the shell to exit whenever a pipeline, list, or compound command exits with non-zero status; | |
set -u causes the shell to exit whenever it attempts to expand a parameter which isn't defined. | |
set -o pipefail If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or | |
zero if all commands in the pipeline exit successfully. This option is disabled by default. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum groupinstall "Development Tools" | |
sudo yum install make glibc-devel gcc patch | |
sudo yum install gcc-c++ | |
sudo yum install openssl-devel | |
update-alternatives --config gcc ( choose gcc48) | |
/usr/local/bin/virtualenv test-env | |
source test-env/bin/activate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xcodebuild -list -workspace BaseNetworkConcept.xcworkspace/ -json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Most common Bash date commands for timestamping | |
From time to time I get asked how to use the date command to generate a timestamp. Here is an idiot-friendly script you can post for reference in your team’s bin/ if you get interrupted about timestamp questions or have an aversion to typing phrases like “man date” (with or without a space). | |
All but the first one and last three produce filename-friendly strings. | |
A big thanks to the following folks for pointing out mistakes and suggesting useful format inclusions: | |
2013-05: Rich for the reminder to include UTC and timezoned stamps. | |
2017-10: “Hamilton and Meg” (haha!) for pointing out I had my 4 year example formats messed up and for prodding me to include a 2-year example. | |
2018-01: Autumn Gray for suggesting that I add examples of including short and long days of the week. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread.getAllStackTraces().keySet().each() { | |
if (it.name.contains('JOB_NAME')) { | |
println "Stopping $it.name" | |
it.stop() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
def lambda_handler(event, context): | |
client = boto3.client('s3') | |
res = client.get_object(Bucket='szabgab', Key='abc.json') | |
content = res["Body"].read() | |
data = json.loads(content) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-initialize.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo dd if=/dev/zero of=/swapfile count=4096 bs=1MiB | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
swapon -s | |
/etc/fstab | |
/swapfile swap swap sw 0 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Usage: sudo $0 /dev/sdh1" | |
exit 1; | |
fi | |
dd if=$1 of=/dev/null & pid=$! | |
while true; do | |
ps -p$pid --no-heading || break; | |
echo "-- $(date) ------------------"; |