References:
From man page: man apt_preferences
## Install trusty desktop on an NVMe device (with uefi) | |
sudo apt-get install ovmf zsync | |
qemu-img create nvme.img 10G | |
zsync http://cdimage.ubuntu.com/daily-live/current/trusty-desktop-amd64.iso.zsync | |
# copy OVMF.fd to use "-pflash" option and thus have persistent nvram storage | |
cp /usr/share/ovmf/OVMF.fd . |
References:
From man page: man apt_preferences
#!/usr/bin/env python3 | |
""" | |
Watch the clipboard for URLs and open them in the browser (on Linux) | |
""" | |
import subprocess | |
import time | |
import pyperclip # Requires xclip to be apt installed |
#!/usr/bin/env python3 | |
"""Generate a presigned URL to download an S3 object | |
<cmd> bucket_name key_name [expiration_days]""" | |
import sys | |
import boto3 | |
from botocore.client import Config |
#!/bin/bash -e | |
# Measure the bytes read by a command | |
# count_command_io <cmd> <args>* | |
# Credit to shodanex from https://stackoverflow.com/a/8853287 | |
if [ -z $@ ] ; then | |
echo "Usage: $0 <cmd> <args>*" | |
exit 1 | |
fi |
import inspect | |
def print_args(): | |
'''Print the callers function name along with argument values''' | |
# TODO: print * and ** args | |
frame, _, _, name, _, _ = inspect.getouterframes(inspect.currentframe())[1] | |
args, _, _, values = inspect.getargvalues(frame) | |
print("%s: %s)" % (name, ["%s=%s" % (i, values[i]) for i in args])) |
""" | |
Play with AWS EC2 describe_instance_types | |
""" | |
from boto3.session import Session | |
sess = Session() | |
ec2c = sess.client('ec2') | |
resp = ec2c.describe_instance_types() |
#!/bin/bash -eu | |
set -o pipefail | |
# Run a command and report status to https://healthchecks.io | |
usage() { | |
echo "Usage: $0 <healthchecks.io UUID> <command>" | |
exit 1 | |
} | |
trap usage EXIT |
name: hello | |
services: | |
- name: hello | |
http_port: 80 | |
image: | |
registry_type: DOCKER_HUB | |
registry: nginxdemos | |
repository: hello | |
tag: latest |