Skip to content

Instantly share code, notes, and snippets.

@ludenus
ludenus / profile_eks_container.sh
Last active July 15, 2023 22:14
profile_eks_container.sh
#!/bin/bash
set -a # export all functions
set -e
set -o pipefail
me=`basename "$0"`
date_fmt='+%Y-%m-%d %H:%M:%S %z'
export version=${JA_PRF_VERSION:-'2.9'}
@ludenus
ludenus / prepare_eks_node.sh
Last active July 14, 2023 22:05
prepare eks node for running java asyc profiler
#!/bin/bash
set -a # export all functions
set -e
set -o pipefail
me=`basename "$0"`
date_fmt='+%Y-%m-%d %H:%M:%S %z'
export version=${JA_PRF_VERSION:-'2.9'}
#!/bin/bash
set -e
echo "==================== before cleanup: `date --utc --iso-8601=seconds`"
df -h | grep -v ^overlay | grep -v ^tmpfs | grep -v ^shm | grep -v /snap/
echo ""
if which docker; then
@ludenus
ludenus / profile_dockerized.sh
Last active June 29, 2022 12:18
This script run java async profiler against dockerized app
#!/bin/bash
set -e
function die() {
local msg=${1:-"ERROR: die for reason unknown"}
local code=${2:-254}
echo "${msg}" >&2
exit ${code}
}
@ludenus
ludenus / gist:0c6714b760447047d18249890fe4c5b5
Last active March 14, 2022 14:26
directory-based separation for personal and work bitbucket

Generate ~/.ssh/id_rsa_git ssh key for personal projects, add public key part to your personal bitbucket account.

Generate ~/.ssh/id_rsa_wrk ssh key for work projects, add public key part to your work bitbucket account.

Create ~/git dir for personal projects.

Create ~/wrk dir for work projects.

@ludenus
ludenus / dockerhub-v2-api-organization.sh
Last active December 6, 2023 09:26 — forked from kizbitz/dockerhub-v2-api-organization.sh
Get the list of images and tags for a Docker Hub organization account (UPD: traverse all pages)
#!/bin/bash
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
export PATH=/tmp/bin:$PATH
if [ ! `which jq` ]; then
mkdir -p /tmp/bin
curl -s -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 --output /tmp/bin/jq
@ludenus
ludenus / bash waiters
Last active October 22, 2021 15:32
bash waiters curl, netcat, wget, cassandra
while [[ "200" != "$(curl -v -s -o /dev/null -w '%{http_code}' ${url})" ]]; do
sleep 10
done
function wait_wget() {
local url=$1
while true; do
@ludenus
ludenus / Jenkinsfile
Created May 16, 2018 14:09
basic host info
sh 'env|sort'
sh 'set +e; set -x; uname -a; whoami; hostname; ip addr show; mvn -version; df -h; free -m; cat /proc/cpuinfo; docker ps -a; docker images; pwd; ls -pilaF; set +x;'
sh '''ps aux | awk '{print $2, $4, $11, $0}' | sort -k2rn | head -n 20'''
@ludenus
ludenus / Jenkinsfile
Created May 11, 2018 21:28
Jenkins shell
stage('nc'){
node('master'){
sh 'ip addr show;rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc -l -p 10001 >/tmp/f'
// to connect:
// $ nc master-host 10001
}
}