Skip to content

Instantly share code, notes, and snippets.

ansemjo / singlevue.html
Created Jan 29, 2021
an absolutely minimal vue app example with everything in one file (except for vue itself)
View singlevue.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
ansemjo / ubuntu-cleaner
Created Oct 31, 2020
Clean up unwanted packages on a fresh installation of Ubuntu 20.04 LTS
View ubuntu-cleaner
#!/usr/bin/env bash
set -eu
# mark a few packages as explicitly installed
mark-wanted() {
apt install -y \
bash git tmux vim htop \
unattended-upgrades \
ansemjo /
Created Sep 30, 2020
parse a humble book bundle downloads page and output a more useful json for bulk downloading
#!/usr/bin/env python3
# download multiple books from a humblebundle books page at once
# the "bulk download" button on their site is useless ...
# you *might* need to copy / export the page html from developer tools
from pyquery import PyQuery as pq
import sys, json
# read in page html from stdin
ansemjo /
Created Jun 11, 2020
yet another script to add wireguard client peers on an openwrt router from ssh
set -eu -o pipefail
# MIT License
# Copyright (c) 2020 Anton Semjonov
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
ansemjo /
Created May 27, 2020
pipe files to s3 with boto3. you should probably use pure bash/curl instead:
#!/usr/bin/env python3
# botoput is a simple Python script to upload files to an S3-
# compatible endpoint by piping data to stdin:
# echo 'Hello, World!' | ./botoput -c s3.ini bucket/hello.txt
# Example configuration file:
# [s3]
ansemjo /
Last active Oct 14, 2020 — forked from chrismdp/
uploading files to S3 in shell with a little bit of curl and openssl
#!/usr/bin/env bash
set -e -o pipefail
usage() { cat >&2 <<USAGE
usage: s3put [-a acl] [-p pinnedkey] [-h] endpoint file objectpath
-a acl : use a different acl for uploaded files
-p pinnedkey : sha256 pinned public key for certificate validation
-h : display this help
endpoint : endpoint url, e.g.
ansemjo / psa-installer-certupdate@.service
Created May 7, 2020
concatenate letsencrypt certificates on a plesk host for the psa installer
View psa-installer-certupdate@.service
Description=Update Plesk Installer TLS Certificate with %i's LetsEncrypt chain
ansemjo /
Last active May 26, 2020
minimal blink exmaple for the otterpill with platformio and the stm32cube-hal
ansemjo /
Last active May 12, 2021
create an encrypted dvd with squashfs and luks

1. Create compressed squashfs image

Use mksquashfs to create a compressed image from a directory. Depending on how compressible the files are you could put on much more than 4.7 GB on a single disc.

mksquashfs /path/to/my/directory image.sqfs

You can use a different compression algorithm with e.g. -comp zstd or append multiple times to one archive to fill it up to almost the allowable size.

2. Reencrypt the image to wrap it in a LUKS container

ansemjo /
Created Apr 10, 2020
an example of a vanilla WebSocket-based chat with Python's aiohttp server
from aiohttp import web
import os, binascii
import asyncio
import weakref
import datetime
app = web.Application()
app["ws"] = weakref.WeakSet()
routes = web.RouteTableDef()