This file contains 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
#!/bin/bash | |
source $HOME/.env/old_dot_custom/fx_msgFormatting.sh | |
_scriptname="$(basename $0)" | |
_forceKill=$1 | |
_stringtokill="$@" | |
function pidlist_gen() { | |
ps -eo pid= -o cputime= -o comm= | grep -v grep | grep -i ${_stringtokill} |
This file contains 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 | |
# Define ANSI color escape code | |
# color <ansi_color_code> | |
color() { printf "\033[${1}m"; } | |
# No Color | |
NO_COLOR=$(color "0") | |
NC=${NO_COLOR} |
This file contains 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 | |
## Output formatting helper for bash | |
source ~/.env/bash_helpers/vars_colours.sh | |
## Get exit status of process that's piped to another | |
set -o pipefail | |
## fx |
This file contains 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
#!/bin/bash | |
# Source bash output formatting helper | |
source ${BASH_HELPERS}/msg_format.sh | |
# Strings to replace before building site "orignal1:::new1" "original2:::new2" | |
declare -a stringsToReplace=("original1:::new1" "original2:::new2") | |
for string in "${stringsToReplace[@]}"; do |
This file contains 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
0 ✓ steve@hal9000 ~ $ figlist | \ | |
awk '/fonts/ {f=1;next} /control/ {f=0} f {print}' |\ | |
while read font; do\ | |
printf "\n\n\n>>> Font: $font\n\n" | |
echo 'Hamburgefonstiv' | \ | |
figlet -w 150 -f $font | |
done | |
This file contains 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
// Puppeteer | |
const puppeteer = require('puppeteer'); | |
// PostgreSQL | |
const pg = require('pg'); | |
// Login + PostgreSQL credentials | |
const CREDS = require('./creds'); | |
// Base URL | |
const URL = 'https://<WOOCOMMERCE_FQDN>' | |
const PRODUCT = '<PRODUCT_URL_PATH>' |
This file contains 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
#!/bin/bash | |
# Fail on error | |
set -e | |
source "$1" | |
cd "$(dirname "$0")" | |
if [ $# -ne 1 ]; then |
This file contains 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 plot_piechart(data, column_numbers, column_index): | |
""" | |
Plots a preformated pie chart | |
- data: dataframe | |
- column_values: column name for quantitative values | |
- column_index: column name for qualitative values | |
""" | |
''' colormaps: https://matplotlib.org/examples/color/colormaps_reference.html | |
https://matplotlib.org/tutorials/colors/colormaps.html#kovesi-colormaps''' |
This file contains 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 group_small_values(data, idx, column, percentage): | |
""" | |
Groups small dataframe values into a sigle group | |
- data = source dataframe | |
- idx = column with qualitative values | |
- column = column to evaluate | |
- percentage = group values which value > sum(column) | |
""" | |
total_column = data[column].sum() | |
other_percentage = ((float(total_column) / float(100) * float(percentage))) |
This file contains 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 imports_version(): | |
""" | |
Print imported modules and its version | |
Source: https://stackoverflow.com/a/50396275 | |
""" | |
import sys | |
for module in sys.modules: | |
try: | |
print(module,sys.modules[module].__version__) |