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
| cat <<__EOF__ > /etc/apt/sources.list.d/python3.list | |
| deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main | |
| deb-src http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main | |
| __EOF__ | |
| apt-key adv --keyserver keyserver.ubuntu.com --recv 6A755776 | |
| apt update | |
| apt install python3.7 |
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
| error: (zipimport.ZipImportError: can't decompress data; zlib not available) | |
| sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / |
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
| /var/log/cloud-init-output.log |
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 apt-do () { | |
| # disable any interactive dialogs and install new configs. | |
| DEBIAN_FRONTEND=noninteractive apt-get -q -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew $@ | |
| } | |
| apt-do install "package name" | |
| or | |
| apt-do upgrade |
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
| # convert string time to epoch | |
| In [1]: from datetime import datetime | |
| In [2]: ts = '2017-01-16 19:35:49.105642' | |
| In [3]: datetime.strptime(ts, "%Y-%m-%d %H:%M:%S.%f").strftime("%s") | |
| Out[4]: '1484613349' |
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
| [[ $1 == ?(-)+([0-9]) ]] && echo "$1 is an integer" |
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
| for i in {1..500}; do touch -d "$(date -d @$(expr $(date +%s) - ${RANDOM}) +'%d %B %Y %H:%M')" file.${RANDOM};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
| import os | |
| import sys | |
| scriptname = os.path.basename(sys.argv[0].split('.')[0]) | |
| # configure logging | |
| from loguru import logger as log | |
| log.remove() # supress luguru core stderr output | |
| log_path = '/var/log/' | |
| log.add(log_path + scriptname + "_{time:YYYYMMDD}.log", | |
| format="{time:MMM DD YYYY HH:mm:ss.SSS}-{level}-{function}-{message}", |
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://coderwall.com/p/if9mda/automatically-set-paste-mode-in-vim-when-pasting-in-insert-mode |
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
| in MacOs, hydrogen looks at /Users/<USER>/Library/Jupyter/kernels/python3/kernel.json for its kernel but when you are using pyenv and you install a kernel with ipykernel, it the kernel.json file is stored in /usr/local/share/jupyter/kernels/python3/kernel.json | |
| The solution is to copy or symlink the installed kernel.json to where hydrogen expects the file to be: | |
| ln -sf /usr/local/share/jupyter/kernels/python3/kernel.json /Users/<USER>/Library/Jupyter/kernels/python3/kernel.json | |
| You'll have to re-start atom. |