Some handy lxc commands.
lxc start $(lxc ls -cn --format csv)
lxc stop -f $(lxc ls -cn --format csv)
lxc delete -f $(lxc ls -cn --format csv)
lxc image delete $(lxc image ls -cf --format csv)
lxc image cp images:alpine/3.10 local: --copy-aliases
#!/bin/sh | |
my_color=$(printf "%02x%02x%02x" \ | |
$(shuf -i 1-255 -n 1) \ | |
$(shuf -i 1-255 -n 1) \ | |
$(shuf -i 1-255 -n 1)) | |
echo "New color: ${my_color}" | |
magick -size 1920x1080 \ | |
xc:#${my_color} \ |
sudo apt update \ | |
&& sudo apt upgrade \ | |
&& sudo apt install clang lld lldb |
#!/usr/bin/env python2 | |
"""Run server""" | |
import SimpleHTTPServer | |
import SocketServer | |
import webbrowser | |
import socket | |
import argparse | |
def main(port=8000): |
from requests import ConnectTimeout, get | |
from os.path import join, dirname, isfile | |
from zipfile import ZipFile | |
import random | |
import csv | |
try: | |
from io import BytesIO | |
except ImportError: | |
from StringIO import StringIO | |
BytesIO = StringIO |
apm uninstall `apm list --installed --bare | sed 's/@.*//g'` |
#!/usr/bin/env python | |
""" | |
Python wrapper thing""" | |
# encoding: utf-8 | |
import os | |
from os.path import curdir, join, isfile | |
from subprocess import check_call | |
import sys | |
try: | |
from pip.locations import running_under_virtualenv |
docker run --privileged -v /var/run/docker.sock:/run/docker.sock -ti -e TERM tomastomecek/sen |
Automatically escape a string for shell expansions!
$ alias shellescape="python -c 'import sys,subprocess;sys.stdout.write(subprocess.list2cmdline([sys.stdin.read()]))'"
$ echo '{"username":"$MYUSERNAME","password","$MYPASSWORD"}' | shellescape
{\"username\":\"$MYUSERNAME\",\"password\",\"$MYPASSWORD\"}
#!/usr/bin/env python | |
# PYTHON_ARGCOMPLETE_OK | |
"""# For shell completion: | |
# eval "$(swear -c)" | |
_python_argcomplete() { | |
local IFS='' | |
COMPREPLY=($(IFS="$IFS" COMP_LINE="$COMP_LINE" COMP_POINT="$COMP_POINT" \ | |
_ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" _ARGCOMPLETE=1 "$1" \ | |
8>&1 9>&2 1>/dev/null 2>/dev/null) ) |