App-Cheats
view release on metacpan or search on metacpan
sudo apt-get purge <package>
# Remove a system package along with its dependencies and configuration
sudo apt-get purge --auto-remove <package>
# Add packages to apt-get install list
apt edit-sources # similar to: vi /etc/apt/sources.list
deb [trusted=yes] http://ftp2.de.debian.org/debian/ stable main contrib
apt-get update
# Apt update has many 404 errors.
# Fix with:
sudo apt dist-upgrade.
#############################################################
## Linux Commands - apt-key
#############################################################
# Add the key of a package site to allow installing from other sources
wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add -
#############################################################
## Linux Commands - date
#############################################################
# Format for date timestamps in scripts (primitive)
date "+%Y-%m-%d_%H:%M:%S"
# Convert epoch seconds to absolute time (@ means UNIX timestamp)
perl -le 'print ~~ localtime 1484048121'
date -d @1484048121
date -r 1484048121 # Mac
# Date is taken from a variable/string
tool_log_file=`date --date="@$START_DATE" "+%YY_%mm_%dd_%HH_%MM_%SS"`
#############################################################
## Linux Commands - declare, typeset
#############################################################
# List function declarations/names in bash
#############################################################
# Using json in a python webserver
#
import json
class Server:
def info(self):
try:
return json.dumps(possible_endpoints)
except KeyError:
return bottle.HTTPError(404, "Error occurred")
#############################################################
## Python Modules - logging
#############################################################
# Log format to use for the logger
log_format = '%(asctime)s %(levelname)s %(module)s.%(funcName)s:%(lineno)d %(message)s'
# Using rotating logs in python (at midnight the log file changes)
( run in 1.510 second using v1.01-cache-2.11-cpan-39bf76dae61 )