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
This application is intended for the private use of its developer. Any unauthorized users which connect to this service should have no expectation of privacy or protection of their data. |
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 str_isnullorwhitespace(value: str) -> bool: | |
""" | |
Indicates whether a specified string is `null`, empty, or consists only of | |
white-space characters | |
Parameters | |
----------- | |
value: str | |
The string to test. |
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
import re | |
def count_sentences(text: str) -> int: | |
""" | |
Count the number of sentences in a given string. | |
This function is based on the Stack Overflow answer https://stackoverflow.com/a/38589115/7706917 | |
Inputs | |
-------- |
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
@echo off | |
PUSHD %~dp0 | |
:: Do some stuff | |
:: Return to the caller directory | |
POPD |
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 | |
if git tag > /dev/null 2>&1 && [ $? -eq 0 ]; then | |
git rm -r --cached . | |
git clean -dfX | |
git add . | |
else | |
echo "fatal: not a git repository (or any of the parent directories): .git"; | |
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
#!/bin/bash | |
kubectl get pods --all-namespaces | grep -E 'ImagePullBackOff|ErrImagePull|Evicted' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod | |
#kubectl get pods --all-namespaces --field-selector 'status.phase==Failed' -o json | kubectl delete -f - |
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
#pragma once | |
#include <limits> | |
/** | |
* Check if a and b are within epsilon range of eachother. | |
* | |
* Based on this post: https://www.reddit.com/r/ProgrammerHumor/comments/ggwxjp/the_dwindling_sanity_of_valves_programmers/fq646zf?utm_source=share&utm_medium=web2x | |
**/ | |
template<typename T> // Numeric type |
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 | |
docker rm -v $(docker ps -a -q -f status=exited) | |
docker rmi $(docker images -f "dangling=true" -q) | |
if [[$1 == "-vfs" ]]; then | |
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin | |
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
#!/bin/bash | |
# https://wiki.archlinux.org/index.php/Wake-on-LAN | |
sudo pacman -Syu ethtool | |
# d (disabled), p (PHY activity), u (unicast activity), m (multicast activity), | |
# b (broadcast activity), a (ARP activity), and g (magic packet activity) | |
ethtool <interface> | grep Wake-on | |
# If not g | |
ethtool -s <interface> wol g |
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 | |
# Git branch recognizer # TODO: Auto add | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\] $(parse_git_branch)\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ ' |
NewerOlder