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
cpu_threshhold=80 ; cpu_idle=$(top -b -n 1 | grep Cpu | awk '{print $8}'|cut -f 1 -d '.') ; cpu_usage=$(expr 100 - $cpu_idle) ; if [ $cpu_usage -gt $cpu_threshhold ]; then exit 1; else exit 0; fi |
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 | |
# author: https://github.com/InbarRose | |
if [ $# -lt 1 ]; then | |
echo "usage: fix_symlinks.sh <symlink_dir>" | |
echo "fix symlinks that have backslashes instead of slashes (such as when copying them into docker from windows)" | |
exit 1 | |
fi |
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 __recursive_dict_compare_dispatch(self, dict_data, dict_conf, **kwargs): | |
# get dispatchers from kwargs // do not pop them out, we need them to recurse | |
isinstance_dispatch = kwargs.get('isinstance_dispatch') | |
issubclass_dispatch = kwargs.get('issubclass_dispatch') | |
no_handle_dispatch = kwargs.get('no_handle_dispatch') | |
raise_no_dispatch = kwargs.get('raise_no_dispatch', True) | |
# loop over all the keys in this layer of the defaults | |
for conf_key, conf_value in dict_conf.items(): | |
# we should only enter one of these conditions | |
# check for isinstance condition and dispatch |
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
from operator import itemgetter | |
def hyperslice(iterable, *args): | |
if len(args) == 1 and isinstance(args[0], str): | |
return itemgetter(*map(slice_or_index, args[0].split(',')))(iterable) | |
elif args: | |
return itemgetter(*args)(iterable) | |
else: | |
return iterable |