Disk passthrough to a VM managing my ZFS array.
$ qm set 100 -scsi1 /dev/disk/by-id/…
$ qm set 100 -scsi2 /dev/disk/by-id/…
$ …
# Micro SD | |
## read | |
sudo hdparm -Tt /dev/mmcblk0 | |
/dev/mmcblk0: | |
Timing cached reads: 2190 MB in 2.00 seconds = 1095.17 MB/sec | |
Timing buffered disk reads: 126 MB in 3.04 seconds = 41.46 MB/sec | |
## write |
# 1. Setup raspbian lite - no desktop environment or Xorg necessary. Install `fbi`. | |
# 2. Sync files to Pi: | |
rsync -ahP --delete ./slides remote-ssh-host:~ | |
# 3. Append to ~/.profile to run on startup | |
if [[ $(fgconsole 2>/dev/null) == 1 ]]; then | |
fbi -d /dev/fb0 -noverbose -a -t 60 -cachemem 0 $HOME/slides/* |
#!/bin/sh | |
curl -sS 'https://raw.githubusercontent.com/openzfs/zfs/master/META' | awk '$1 == "Linux-Maximum:" { print $2; exit }' |
# install go-task | |
--- | |
version: "3" | |
vars: | |
PROJECT: myproject | |
SECRETS_FILE: sops.env | |
COMPOSE_FILES: | |
sh: find . -type f -iname "compose*.yaml" -exec basename {} ';' | sort -r | |
COMPOSE_FILES_ARGS: -f {{ .COMPOSE_FILES | splitLines | join " -f " }} |
version: "3" | |
name: utils | |
x-options: &options | |
environment: &environment | |
TZ: "${TIMEZONE}" | |
restart: unless-stopped | |
networks: | |
- utils |
defmodule MyApp.RepoConnectionReaper do | |
@moduledoc """ | |
Disconnect all connections after a X minutes to reset cache build-up and leaky memory on long-lived connections | |
Especially useful for dynamic queries which contribute to this build-up. | |
Alternatively, use this Repo option e.g. `Repo.all(query, prepare: :unnamed)` to avoid using named prepared statements | |
on queries that are dynamic enough to not cache the prepared statement on the connection. | |
See also | |
- https://github.com/elixir-ecto/db_connection/issues/99 |
#!/bin/bash | |
find /dev/disk/by-id/ -type l | xargs -I{} ls -l {} | grep -v -E '[0-9]$' | sort -k11 | cut -d' ' -f9,10,11,12 |
#!/usr/bin/python | |
from slack_cleaner2 import * | |
s = SlackCleaner('TOKEN') | |
channel = "CHANNEL_NAME" | |
for msg in s.c[channel].msgs(with_replies=True): | |
if msg.user == s.myself: | |
print(f"DELETED: {msg.text}") |
// Nullable user example: | |
type MaybeUser = UserQuery['user'] | |
/** | |
* Possibly null user, such as on an auth page | |
* Here's a description on why these overloads are required: https://stackoverflow.com/a/67640634 | |
*/ | |
export function useMaybeUser<UserData = MaybeUser>( | |
select: (user: MaybeUser) => UserData |