Skip to content

Instantly share code, notes, and snippets.

View gargolito's full-sized avatar

Anthony Camilo gargolito

View GitHub Profile
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
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 /
/var/log/cloud-init-output.log
@gargolito
gargolito / apt-do
Last active April 26, 2019 11:57
#linux fully hands-off apt-get install/upgrade
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
# 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'
[[ $1 == ?(-)+([0-9]) ]] && echo "$1 is an integer"
for i in {1..500}; do touch -d "$(date -d @$(expr $(date +%s) - ${RANDOM}) +'%d %B %Y %H:%M')" file.${RANDOM};done
@gargolito
gargolito / loguru preferred setup
Last active May 25, 2019 14:35
loguru prevent stdout from core module
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}",
@gargolito
gargolito / links
Created July 22, 2019 13:47
#linux #vim
@gargolito
gargolito / hydrogen_kernel_pyenv.txt
Created August 30, 2019 17:50
Atom Hydrogen Kernels with pyenv
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.