Skip to content

Instantly share code, notes, and snippets.

View kasunbg's full-sized avatar
🐶

Kasun Gajasinghe kasunbg

🐶
View GitHub Profile
#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "usage: sh thread-analyze.sh <pid> <number-of-dumps> <interval>"
exit
fi
count=$2
for i in `seq 1 $count`;
do
jstack -l $1 > thread_dump_`date "+%F-%T"`.txt &
Jenkins.instance.getItemByFullName("manuri/test-build")
.getBuildByNumber(123)
.finish(
hudson.model.Result.ABORTED,
new java.io.IOException("Aborting build")
);
@kasunbg
kasunbg / nginx.conf
Created August 15, 2018 08:39
Nginx configuration for Nexus Sonatype that apache maven built artifacts
listen *:80;
server_name maven.kasunbg.org;
access_log /var/log/nginx/maven.kasunbg.org/access.log;
error_log /var/log/nginx/maven.kasunbg.org/error.log;
# allow large uploads of files - refer to nginx documentation
client_max_body_size 3072m;
# optimize downloading files larger than 1G - refer to nginx doc before adjusting
@kasunbg
kasunbg / infrastructure.properties
Last active May 23, 2019 12:03
Sample testgrid.yaml
#Sample Testgrid deployment / infrastructure.properties file.
#Thu May 23 11:59:20 UTC 2019
DepValue1=12345
TESTGRID_TINKERER_PASSWOR=********
TESTGRID_TINKERER_ENDPOINT=http\://localhost\:8080/deployment-tinkerer/v0.9
BallerinaVersionType=RC
dockerhub_ballerina_scenarios_username=ballerinascenarios
RCLocation=https\://product-dist.ballerina.io/nightly/0.992.0-m2-SNAPSHOT/ballerina-0.992.0-m2-SNAPSHOT.zip
ElasticSearchEndpoint=https\://search-testgrid-dev-********.us-east-1.es.amazonaws.com
IS_TESTGRID=True
@kasunbg
kasunbg / test.sh
Last active August 13, 2019 09:43
Testgrid test.sh template
set -euxo pipefail # This provide better error handling for shell scripts
HOME=`pwd`
TEST_SCRIPT=test.sh
function usage()
{
echo "
Usage bash test.sh --input-dir /workspace/data-bucket/in --output-dir /workspace/data-bucket/out
@kasunbg
kasunbg / Jenkinsfile
Created December 30, 2018 13:00
Jenkinsfile with Docker
pipeline {
agent {
docker { image 'mysql:5.6.37' }
}
stages {
stage('Run tests') {
steps {
sh 'pwd'
sh """
@kasunbg
kasunbg / 1.this.is.a.xml
Last active November 30, 2021 20:30
Write valid YAML without indentation by using curly-braces. See 3.this.is.a.valid.explicit.yaml
<Colors>
<Red>FF0000</Red>
<Blue>0000FF</Blue>
<Green>008000</Green>
</Colors>
@kasunbg
kasunbg / delete-unused-security-groups.sh
Created January 11, 2019 12:36
Delete unused AWS security groups
comm -23 <(aws ec2 describe-security-groups --query 'SecurityGroups[*].GroupId' --output text | tr '\t' '\n'| sort) \
<(aws ec2 describe-instances --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId' --output text | tr '\t' '\n' | sort | uniq) \
| tee -a unused-security-groups-in-ec2.txt
for x in `cat unused-security-groups-in-ec2.txt`; do echo 'deleting sg: $x' ; aws ec2 delete-security-group --group-id $x; done
# Instructions and command outputs when running helm install for apim-analytics
# Repo: https://github.com/wso2/kubernetes-apim/tree/master/helm/pattern-1
kasun@gaje:~/k8s/kubernetes-apim/helm/pattern-1$ helm install --name wso2apim-with-analytics-rdbms-service -f mysql/values.yaml stable/mysql --namespace wso2
NAME: wso2apim-with-analytics-rdbms-service
LAST DEPLOYED: Sat Feb 23 11:30:01 2019
NAMESPACE: wso2
STATUS: DEPLOYED
RESOURCES:
==> v1/Secret
@kasunbg
kasunbg / delete-k8s-namespaces.sh
Created March 22, 2019 03:13
Delete k8s namespaces that are more than one day old
#!/bin/bash
kubectl get namespaces | sort -n -k3 | grep "kubernetes-namespace.*d$" | awk '{print $1}' | xargs kubectl delete namespaces