Skip to content

Instantly share code, notes, and snippets.

View Preskton's full-sized avatar
this code fills me with DETERMINATION

Preston Doster Preskton

this code fills me with DETERMINATION
View GitHub Profile
@Preskton
Preskton / README.md
Last active July 6, 2023 16:32
Hachyderm Interactive Mastodon Upgrade Script

Hachyderm Interactive Mastodon Upgrade Script

This is the interactive script the Hachyderm team ran to upgrade to Mastodon version v4.1.3. Please note by interactive, we mean human-powered. This is not yet meant to be run in an automated fashion.

We have a couple of interesting things about our infrastructure:

  • We're not running in Docker nor Kubernetes, we install directly to the host.
  • We're running Arch and because of this, we're running Node v19 (not the v16 recommneded by Mastodon). This means we have to do a little more around openssl when running the assets precompile
  • We run several different servers, each with a unique "role" - mastodon-web, mastodon-sidekiqs, mastodon-streaming. This provides us flexibility if we need to scale a particular component.
  • We preserve X number of old versions of mastodon on our hosts (/var/lib/mastodon-versions) and use symlinks to /var/lib/mastodon in the event we need to rollback.

List hostnames with certain tags

The .Tags // [] is the key - sometimes .Tags is null, which can cause jq to stop processing the stream early.

tailscale status --json | jq '.Peer | to_entries[].value | select(.Tags // [] | contains(["tag:env-prod", "tag:role-edge"])) | .HostName'
#include <LiquidCrystal_I2C.h>
#include <Key.h>
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
package main
import (
"fmt"
)
func main() {
fmt.Println("iuykbbooloooobwoomy xander ip address 1111111111111 nhjkolp 2468")
fmt.Println("bvcxzzxcvblkjhgfdsasdfghjkl,mnnmpoiuytrewqqwertyuiop098765432112345678900123456789")
fmt.Println("lkyiyiujyu7jguhyjgyuhh=hnbjnbhbb+ukhkjhkkjkkkIUIUIUIUU1234567890098765432")
@Preskton
Preskton / aza
Created October 23, 2018 15:57
Query all Azure subscriptions with Azure CLI
SUBSCRIPTION_NAMES=$(az account list | jq -r --arg ACCOUNT_FILTER "$AZA_ACCOUNT_FILTER" '.[].name | select(. | contains($ACCOUNT_FILTER))')
echo "$SUBSCRIPTION_NAMES" | while read subscription; do
az "$@" --subscription "$subscription"
done
@Preskton
Preskton / set-cosmosdb-rus.sh
Created January 3, 2018 17:46
Set all Azure Cosmos DB instances to standard RUs
################################################################################################################
# Cosmos DB Azure Toolkit - Set Azure CosmosDB instance databases to standard throughput (RUs)
#
# Prereqs
# ----------
# - `jq` - to install, `apt-get install jq`
# - Azure CLI (`az`) - to install, `curl -L https://aka.ms/InstallAzureCli | bash` and restart your shell
#
# Usage
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.MSBuild;
using Microsoft.CodeAnalysis.FindSymbols;