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
#!/usr/bin/env bash | |
LOADING_SYMBOLS=("\\" "|" "/" "-") | |
INDEX=0 | |
while true; do | |
INDEX=$(bc <<< "($INDEX + 1)%4") | |
echo -ne "${LOADING_SYMBOLS[$INDEX]} \033[0K\r" | |
done |
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
#!/usr/bin/env bash | |
# Console-line parameter parsing script. | |
# Specify options in the OPTS variable in the following format: | |
# whitespace sepparated values | |
# OPTS="--<argument_name> --<argument_with_value>= --!<mandatory_argument>=" | |
# Then it creates variables in the format: OPTS_<ARGUMENT_NAME_IN_CAPS> | |
# If the argument doesn't need value to be provided assings 0 or 1. | |
# If the argument needs value but none is provided a 0 is assigned |
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 sys | |
from datetime import datetime, date | |
class PrettyLogger(object): | |
""" | |
Class wrapper for a system trace function. That makes | |
human readable stack trace logs. | |
""" | |
def __init__(self, logfile=sys.stdout, max_indent=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
# -*- coding: utf-8 -*- | |
import pafy | |
import requests | |
from multiprocessing import Pool | |
import pyglet | |
import os | |
import sys | |
def get_url_from_name(name): | |
words = name.split() |
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
#!/usr/bin/env bash | |
{ | |
#try block | |
cp non/existing/file non/existing/folder | |
} || { | |
#catch block | |
if [ $? != 0 ]; then | |
echo "File copying failed." | |
fi |
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
def out | |
def config = new HashMap() | |
def bindings = getBinding() | |
config.putAll(bindings.getVariables()) | |
out = config['out'] | |
out.println "Printed do Jenkins console." |
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
def command = 'ls | grep foo' | |
def output = ['bash', '-c', command].execute().in.text |
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
def retry(lambda, retries) { | |
for (def i = 0; i < retries; i++) { | |
try { | |
//better replace with logger | |
// println "Retrying: ${i + 1} of $retries" | |
lambda() | |
break | |
} catch (e) { | |
if (i == retries - 1) { | |
throw new Exception('Retrying failed', e) |