Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Konstantin Shcherban kshcherban

🏠
Working from home
View GitHub Profile
@kshcherban
kshcherban / Dockerfile
Created Apr 2, 2019
jenkins casc example
View Dockerfile
FROM jenkins/jenkins:2.150.3
# Install plugins
RUN /usr/local/bin/install-plugins.sh \
git:3.9.1 \
git-client:2.7.3 \
amazon-ecs:1.19 \
job-dsl:1.69 \
configuration-as-code:1.7 \
configuration-as-code-support:1.7 \
View pyoxidizer
root@8d3475ae6b05:/opt/Downloads/PyOxidizer# ls -lah target/debug/pyapp
-rwxr-xr-x 2 root root 86M Feb 20 07:40 target/debug/pyapp
root@8d3475ae6b05:/opt/Downloads/PyOxidizer# ldd target/debug/pyapp
linux-vdso.so.1 (0x00007ffca7ddd000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f56f1ea7000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f56f1ca3000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f56f1a9b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f56f187e000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f56f1667000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f56f12c8000)
@kshcherban
kshcherban / ec2-root-resize.sh
Created Nov 13, 2018
ec2 root volume resize
View ec2-root-resize.sh
#!/bin/bash -e
if [ $# -ne 2 ]; then
echo "Usage: $0 <instance-id> <volume-size-gb> [PARITION_NAME=/dev/xvda2]"
exit 2
fi
INSTANCE="$1"
VOLUME_SIZE="$2"
PARTITION="${3:-/dev/xvda2}"
@kshcherban
kshcherban / asg-ecs-rolling-upgrade.py
Created Jul 10, 2018
Script to upgrade autoscaling group
View asg-ecs-rolling-upgrade.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import boto3
from multiprocessing.dummy import Pool as ThreadPool
import sys
import time
group_name = sys.argv[1]
ag = boto3.client('autoscaling')
@kshcherban
kshcherban / aws-mfa.sh
Last active Sep 1, 2021
Simple script to set AWS creds with MFA auth, just put it in your bashrc like `alias mfa='. ~/.local/bin/aws-mfa.sh $@'`
View aws-mfa.sh
#!/bin/bash
#set -eo pipefail
#
# Sample for getting temp session token from AWS STS
#
# aws --profile youriamuser sts get-session-token --duration 3600 \
# --serial-number arn:aws:iam::012345678901:mfa/user --token-code 012345
#
# 1 or 2 args ok
@kshcherban
kshcherban / ecs-rollback.py
Created Apr 12, 2017
ECS task definition rollback script
View ecs-rollback.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import json
import argparse
from datetime import datetime
from subprocess import Popen, PIPE
@kshcherban
kshcherban / selenium-grid.sh
Created Jan 26, 2017
start stop selenium grid in docker containers
View selenium-grid.sh
#!/bin/bash
### Script to start selenium grid
function usage() {
echo -e "Usage: $0 [OPTION]...
Options:
<-a|--action start|stop>\tstart or stop cluster
[-c|--count 2]\tnumber of nodes to start
[-n|--node chrome|firefox]\tselenium node type
[-v|--version 3.0.1-fermium]\tselenium version
View transliterator.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
def join_punctuation(seq):
characters = set(string.punctuation)
seq = iter(seq)
current = next(seq)
@kshcherban
kshcherban / auto-update-terraform
Last active Apr 23, 2020
Bash script to auto update terraform on linux
View auto-update-terraform
#!/bin/bash
INSTALL_DIR="${1:-/opt/terraform}"
URL="https://releases.hashicorp.com/terraform"
VER="$(curl -sL $URL | grep -v beta | grep -Po "_(\d*\.?){3}" | sed 's/_//' | sort -V | tail -1)"
ZIP="terraform_${VER}_linux_amd64.zip"
echo "* Downloading ${URL}/${VER}/terraform_${VER}_linux_amd64.zip"
curl -s ${URL}/${VER}/terraform_${VER}_linux_amd64.zip -o ${INSTALL_DIR}/${ZIP}
View solo-kvm.sh
#!/bin/bash
#
# solo-cli - CLI for Solo API.
#
# It is recommended to link it to your PATH before using.
#
set -e
action=${1:-list}