I hate GMail, but sometimes you gotta. They're notoriously awful at deleting lots of messages at once, as their own search engine will tell you. I had more than 1,000,000 messages I needed to purge and couldn't do it using their own tools. So I wrote my own.
This file contains 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
#!/bin/bash | |
set -e | |
set -o pipefail | |
function list_tars { | |
ROOT=$1 | |
TAG=${2:-latest} | |
BASE=$(sed -e 's/.*{\(".*"\)}.*/\1/g' "${ROOT}/repositories" | sed 's/"//g' | awk -v RS=',' -F: '/^'${TAG}'/ {print $2}') | |
CUR=$BASE |
This file contains 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
docker_root=/var/lib/docker/btrfs | |
subvolumes=subvolumes | |
docker_image=aputs/archlinux | |
tar_file=/tmp/image.tar.gz | |
# tar | |
cd $docker_root/$subvolumes/$(docker inspect --format='{{.Id}}' $docker_image) | |
tar --exclude={'.','..'} -Pcvzf $tar_file .* * |
This file contains 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 | |
## this is a total hack. acbuild needs systemd-nspawn. initially, I tried | |
## running the go agent in a rkt container, but failed for reasons I forget | |
## right now (overlayfs problems?). then I ran into more problems with systemd- | |
## nspawn on CentOS 7.1, and I forget the origin. we're getting closer: in | |
## CentOS 7.2 I'm able to run acbuild as root outside of a container. but when | |
## running within the go agent, systemd-nspawn is killed for no discernable | |
## reason. so, we're back to faking out acbuild by providing this systemd- | |
## nspawn-alike. |
This file contains 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
#!/bin/sh | |
set -eu | |
container="$(basename "$0")" | |
program="$1" | |
shift | |
# logname returns the user calling sudo | |
host_user="$(logname)" |
OpenELEC runs Kodi, an award-winning free and open source (GPL) software media player and entertainment hub for digital media. For more info see http://kodi.tv . The base system has been designed and built from the ground up to be as efficient as possible – consuming only tiny disk and memory footprints and providing cutting edge hardware support to deliver a set-top box experience.
In order to run software above the base OpenELEC distribution with minimal impact to the OpenELEC base, one alternative is to use a container.
I have chosen to use systemd-nspawn instead of chroot. There are really no downsides as long as you can configure the required kernel config options and have a basic working knowledge of systemd.
Installation
This file contains 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
#!/bin/bash | |
TOOLBOX_DOCKER_IMAGE=$1 | |
TOOLBOX_USER=root | |
machinename=$(echo "${USER}-${TOOLBOX_DOCKER_IMAGE}" | sed -r 's/[^a-zA-Z0-9_.-]/_/g') | |
machinepath="/var/lib/toolbox/${machinename}" | |
if [ ! -d ${machinepath} ] || systemctl is-failed ${machinename} ; then | |
sudo mkdir -p "${machinepath}" |
This file contains 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
# `ref: https://fangpenlin.com/posts/2012/08/26/good-logging-practice-in-python/ | |
import logging | |
logger = logging.getLogger(__name__) | |
logger.setLevel(logging.INFO) | |
# create a file handler | |
handler = logging.FileHandler('hello.log') |
This file contains 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 microbit import * | |
networkID = 0 # Change the channel variable in the radio.configure to this | |
def selectNetwork(): # Call this function before calling anything else | |
global networkID | |
currentID = networkID | |
while True: | |
if button_a.is_pressed() and button_b.is_pressed(): | |
networkID = currentID |