Function | Shortcut |
---|---|
New Window | ⌘ + n |
Go to Window | Option + ⌘ + Number |
Fullscreen | ⌘ + Enter |
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 | |
from collections.abc import Iterator | |
from reportlab.pdfgen import canvas | |
from reportlab.lib.pagesizes import LETTER, landscape | |
from reportlab.lib.units import inch, mm, cm | |
from reportlab.pdfbase import pdfmetrics | |
from reportlab.pdfbase.ttfonts import TTFont | |
# Usage: | |
# label = AveryLabels.AveryLabel(5160) |
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
echo "*** Packing environment ***" | |
pipenv lock --requirements > requirements.txt | |
pip install -r requirements.txt --prefix $LOCAL_PKG | |
PACKAGES_DIR=$(find . -name site-packages) | |
cd $PACKAGES_DIR | |
zip -r $ZIPFILE . | |
cd $OUR_WORKDIR |
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
from pathlib import Path | |
def handler_name(event, context): | |
with Path('web/index.html').open() as file: | |
html = file.read() | |
response = { | |
"statusCode": 200, | |
"body": html, | |
"headers": { |
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
def handler_name(event, context): | |
try: | |
result = '' | |
content_type_header = event['headers']['content-type'] | |
post_data = base64.b64decode(event['body']).decode('iso-8859-1') | |
for part in decoder.MultipartDecoder( | |
post_data.encode('utf-8'), | |
content_type_header | |
).parts: | |
result = reverse_it(part.text.split('\n')) |
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
#!/usr/bin/env bash | |
# Docker Container IP | |
# Usage: | |
# get_container_ips.sh | |
# Prints out all IPs for running containers | |
# | |
# get_container_ips.sh <ID|name> | |
# Prints out the IP for a given container or ID | |
# https://docs.docker.com/engine/reference/commandline/ps/#formatting |
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
# according to https://github.com/ntop/ntopng/issues/153 | |
$ echo -n 'admin' |md5sum | |
21232f297a57a5a743894a0e4a801fc3 | |
$ redis-cli SET ntopng.user.admin.password 21232f297a57a5a743894a0e4a801fc3 | |
OK | |
# check | |
$ redis-cli GET ntopng.user.admin.password |
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 funcname in $(aws lambda list-functions| jq -rc '.Functions|.[]|.FunctionName') ; do | |
echo -n $funcname ... | |
wget $(aws lambda get-function --function-name $funcname | jq -rc '.Code.Location') -O $funcname -o /dev/null && echo ok || echo failed | |
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
# kworker has high load | |
# perf tools like `perf top` show acpi_ns_search_one_scope with high cpu | |
sudo perf record -g -a sleep 10 | |
sudo perf report | |
# find bad interrupts | |
grep . -r /sys/firmware/acpi/interrupts/ | |
# diasble bad interrupt | |
https://gist.github.com/StefanoBelli/0aab46b858a797c4eedb90e8799dffa2 |
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
# create pipenv shell elsewere and install django | |
pipenv install django | |
# go to the directory where your project shall reside in | |
export PROJECT=myproject | |
django-admin.py startproject --template=https://github.com/heroku/heroku-django-template/archive/master.zip --name=Procfile $PROJECT | |
# leave the current shell | |
# create / open a new shell in the project dir | |
cd $PROJECT |
NewerOlder