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
atom |
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
I couldn't find a free desktop clock for MacOS and this solution wourked out great. | |
1. save clock.html | |
2. For MacOS only: install geektool https://www.tynsoe.org/v2/geektool/ | |
3. drag a Web geeklet to desktop. | |
4. use file:///path/to/file.html in the url box | |
5. resize and position to your preference. |
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
"""Function setup as many loggers as you want""" | |
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(module)s - line %(lineno)d - %(message)s') | |
def setup_logger(name, log_file, level=logging.DEBUG): | |
handler = logging.FileHandler(log_file) | |
handler.setFormatter(formatter) | |
logger = logging.getLogger(name) | |
logger.setLevel(level) | |
logger.addHandler(handler) | |
return logger |
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
https://github.com/abrenaut/python-cheat-sheet | |
https://github.com/kjordahl/pythonic | |
https://github.com/geokai/class_dev_toolkit_hettinger | |
https://github.com/sanjanasekar/python_for_engineers_part3 | |
https://github.com/sdodda/pybay | |
https://github.com/astar/big_ideas | |
https://github.com/sankalp58/pycon_raymond_hettinger | |
https://github.com/ZacharyRSmith/py-thinking-about-concurrency | |
https://github.com/jurekkow/raymonds-trinity | |
https://github.com/ilyarudyak/modernpython |
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
class Track(object): | |
def __init__(self): | |
self.__var = None | |
@property | |
def var(self): | |
return self.__var | |
@pid.setter | |
def var(self, value): |
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
# compare two directories | |
diff --brief --recursive --no-dereference --new-file --no-ignore-file-name-case /dir1 /dir2 > dirdiff_1.txt | |
rsync --recursive --delete --links --checksum --verbose --dry-run /dir1/ /dir2/ > dirdiff_2.txt | |
# Given a text file and an integer k, print the k most common words in the file (and the number of their occurrences) in decreasing frequency. https://www.johndcook.com/blog/2019/02/18/command-line-wizard/ | |
cat stuff.txt | tr -cs A-Za-z '\n' | tr A-Z a-z | sort | uniq -c | sort -rn | sed ${1}q |
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
GOTO https://your.jenkins.url/script | |
copy paste the below, update name of the project | |
click run, there will be no output. the project builds will be reset back to zero | |
item = Jenkins.instance.getItemByFullName("PROJECTNAME") | |
//THIS WILL REMOVE ALL BUILD HISTORY | |
item.builds.each() { build -> | |
build.delete() | |
} | |
item.updateNextBuildNumber(1) |
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
with background | |
format \prefix[font_type;color;bgcolor+suffix | |
witout background | |
format \prefix[font_type;color+suffix | |
no color ---------------------------------------| | |
suffix -----------------| | | |
background ---------------| | | | |
font color ----------| | | | | |
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
# must be added before the module to be imported from the specified path | |
import sys | |
sys.path.append("/custom/path/to/modules") | |
import custom_module |
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
[Unit] | |
Description=Demonstrate Bash | |
[Service] | |
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment MYVAR=$(( 2 + 2 ))" | |
ExecStart=/usr/bin/ech "2 + 2 = ${MYVAR}" |
OlderNewer