Source: https://help.ubuntu.com/community/EmailAlerts
Install the ssmtp package
sudo apt-get install ssmtp
Source: https://help.ubuntu.com/community/EmailAlerts
Install the ssmtp package
sudo apt-get install ssmtp
def exception_handler(func): | |
def inner_function(*args, **kwargs): | |
try: | |
func(*args, **kwargs) | |
except TypeError: | |
print(f"{func.__name__} only takes numbers as the argument") | |
return inner_function | |
@exception_handler |
#!/usr/bin/python3 | |
class ReadLine: | |
def __init__(self, s): | |
self.buf = bytearray() | |
self.s = s | |
def readline(self): | |
i = self.buf.find(b"\n") | |
if i >= 0: | |
r = self.buf[:i+1] |
Add MANIFEST.in
, which includes:
include path/to/yourfile.csv
And then in setup()
inside setup.py
, include:
include_package_data=True
#!/bin/bash | |
# This script takes a remote repository and merges it into | |
# the current one as a subdirectory | |
set -e | |
if [ -z "$1" ] | |
then | |
echo "Usage:" |
# Expose localhost at port 5000 to a random subdomain on serveo.net | |
ssh -R 80:localhost:5000 serveo.net | |
# Request a specific subdomain on serveo.net (ie. my-custom-app.serveo.net) | |
ssh -R my-custom-app:80:localhost:5000 serveo.net | |
# SSH session will close if no connections are made, so autossh will automatically reconnect and keep it persistent | |
sudo apt install autossh | |
autossh -M 0 -R my-custom-app:80:localhost:5000 serveo.net |
If running update on a no longer supported Ubuntu version (ie. 19.10):
justin@pop-os:~$ sudo apt update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://apt.pop-os.org/proprietary disco InRelease
Get:3 http://repository.spotify.com stable InRelease [3,316 B]
Hit:4 http://dl.google.com/linux/chrome/deb stable Release
Hit:5 http://packages.microsoft.com/repos/vscode stable InRelease
Ign:6 http://archive.ubuntu.com/ubuntu disco InRelease
# Starts a detached screen and logs to a datestamped log file. '%' characters only need to be escaped if running this command via cron | |
screen -L -Logfile ~/my/log/path/$(date +\%Y-\%m-\%d_\%H-\%M-\%S).log -dm <command> | |
# Execute multiple commands in a detached screen session | |
screen -dm /bin/bash -c "command1 | command 2" |
""" | |
Emailer | |
========== | |
Sends automated emails. Can send as HTML or plain text. | |
Example Usage: | |
.. code-block:: python |