Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️
Coding....

Sergey Sudakovich sergeyhush

⌨️
Coding....
View GitHub Profile
@sergeyhush
sergeyhush / jenkins-create-node.sh
Last active Oct 26, 2021
Jenkins create new node
View jenkins-create-node.sh
#!/bin/bash
JENKINS_URL=$1
NODE_NAME=$2
NODE_SLAVE_HOME='/home/build/slave'
EXECUTORS=1
SSH_PORT=22
CRED_ID=$3
LABELS=build
USERID=${USER}
@sergeyhush
sergeyhush / post-receive
Last active Aug 30, 2021
Post-receive git hook to check if file changed
View post-receive
#!/bin/bash
WATCH_FILE="abc.123"
while read oldrev newrev refname; do
if [ "$refname" = "refs/heads/master" ]; then
if git diff-tree --name-only -r -z $oldrev $newrev | grep --quiet $WATCH_FILE ; then
# WATCH_FILE changed...
fi
fi
done
View resume.json
{
"basics": {
"name":"Sergey Sudakovich",
"label": "Software Enigneer",
"email": "sergey@sudakovich.com",
"summary": "Experiened software enigneer who I passionate about automation",
"profiles":[ {
"network": "Github",
"username":"sergeyhush",
"url": "https://github.com/sergeyhush"
@sergeyhush
sergeyhush / fake_api_driver.sh
Created Jun 28, 2018
Fake API server driver
View fake_api_driver.sh
#!/bin/sh
PORT=8002
SERVER_NAME="127.0.0.1:${PORT}"
trap cleanup EXIT
cleanup(){
kill $(lsof -ti tcp:$PORT)
}
[ ! -d venv ] && virtualenv vevn
View fake_api.py
import os
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/api-token-auth/', methods=['POST'])
def auth():
# Token generated via
# https://jwt.io/#debugger-io?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InNlcmdleUBjdW11bHVzbmV0d29ya3MuY29tIiwibmFtZSI6IlNlcmdleSJ9.1-Tg3LW1QTgNkHrBQR2C2I3e_uiY2olfxlsFctAgwrg
return jsonify({
View etc_hosts_sorted.sh
#!/bin/sh
# Sort /etc/hosts file IPv4 only skipping empty lines and commented out ones
sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n /etc/hosts | grep . | grep -v '^#'
@sergeyhush
sergeyhush / allow_clients.conf
Created Oct 16, 2017
NGINX allow/block location by request method and IP
View allow_clients.conf
geo $allow_client {
default no;
10.0.1.183 yes;
}
@sergeyhush
sergeyhush / init.groovy
Created Dec 23, 2016
Collection of useful methods for Jenkins to be used in init.groovy.d
View init.groovy
import jenkins.model.Jenkins
class InitGroovyD {
/**
* Install plugins.
*
* @param plugins Plugins to be installed
*/
static installPlugins(String... plugins) {
def updateCenter = Jenkins.instance.updateCenter
@sergeyhush
sergeyhush / openvpn2.sh
Created Jul 28, 2016
Cromebook OpenVPN connection script
View openvpn2.sh
#!/bin/sh -e
CONF_DIR=$1
CONFIG="$CONF_DIR/client.ovpn"
RESOLVE_CONF="$CONF_DIR/resolv.conf"
ORIG_RESOLVE_CONF="$CONF_DIR/resolv.conf.orig"
if [ ! -d "$CONF_DIR" ]; then
echo "Could not find config dir $CONF_DIR" >&2
exit 1
View keybase.md

Keybase proof

I hereby claim:

  • I am sergeyhush on github.
  • I am ssergey (https://keybase.io/ssergey) on keybase.
  • I have a public key ASCSgWxQeA1Gsdj06IFETOd35unZXuJ8qS3NOqwOiQkbPQo

To claim this, I am signing this object: