Skip to content

Instantly share code, notes, and snippets.

View lantrix's full-sized avatar
:octocat:
always coding and merging

Ted B lantrix

:octocat:
always coding and merging
View GitHub Profile
@lantrix
lantrix / sync-app-config.sh
Created September 4, 2024 02:29
Sync old app config on moving Mac using rsync
export pref="com.Scooter*"
export app="Beyond\ Compare"
rsync -avu "user@oldmac:~/Library/Application\ Support/${app}" ~/Library/Application\ Support/
rsync -avu user@oldmac:~/Library/Preferences/${pref} ~/Library/Preferences/
export pref="com.sublime*"
export app="Sublime\ Text"
rm -rf ~/Library/Application\ Support/${app}
# List keys
gpg --list-secret-keys |egrep -v 'sec|uid|ssb'
Populate list
keys="A1B2C3D4E5F67890A1B2C3D4E5F67890A1B2C3D4 FEDCBA9876543210FEDCBA9876543210FEDCBA98 1234ABCD5678EFGH1234ABCD5678EFGH1234ABCD"
for key in $keys; do echo "Processing $key"; gpg -k $key | grep uid; done
# Export
@lantrix
lantrix / refresh-music-selection.scpt
Created July 3, 2023 12:00 — forked from Kautenja/refresh-music-selection.scpt
An applescript to refresh the metadata of a selection in the Apple Music application (with progress bar)
tell application "Music"
-- get the selection
set theSongs to selection
end tell
-- setup the progress bar
set theSongCount to length of theSongs
set progress total steps to theSongCount
set progress completed steps to 0
set progress description to "Refreshing Songs..."
# Backend
# You should always check the release notes/changelog in case there are config deprecations, special update steps, etc.
# https://gitlab.com/soapbox-pub/rebased/-/blob/main/CHANGELOG.md
cd /opt/pleroma/
sudo -Hu pleroma bash -i
git pull #on main branch
MIX_ENV=prod mix deps.get # pulls in any new dependencies
exit # back to user
sudo systemctl stop pleroma.service
sudo -Hu postgres pg_dump -d pleroma --format=custom -f /tmp/pleroma.pgdump
@lantrix
lantrix / token.sh
Last active November 13, 2022 09:32
Generate a JWT from a GitHub App for REST API access by your App
# Install JWT Creator https://github.com/trstringer/jwt-creator
go install github.com/trstringer/jwt-creator@latest
# Download GitHub App Private Key as $HOME/app.pem
# https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#generating-a-private-key
# Generate public key from GitHub App Private Key
openssl rsa -in "$HOME/app.pem" -pubout -out "$HOME/app.pub"
# Generate JWT
@lantrix
lantrix / README.md
Last active September 14, 2024 17:59
If you have unsigned commits on a branch, you can re-sign them with your GPG uploaded key. Requires GH CLI, gpg installed.

The base branch requires all commits to be signed If you need to setup GPG, you can read our helpful guide.

Then once you have:

  • gpg installed
  • GitHub CLI installed (optional but useful)
  • a key generated for your Name and email, in this example: Lantrix [email protected]
  • your gpg public key uploaded to GitHub
  • You can rebase and re-sign all the commits and force push the branch as a potential solution.
@lantrix
lantrix / 21-struct-methods.go
Last active August 22, 2022 08:26
How to use interfaces in golang from https://www.youtube.com/watch?v=lh_Uv2imp14
package main
import "fmt"
type Box struct {
name string
colors []int
age int
}
@lantrix
lantrix / Dockerfile.distroless
Created June 21, 2021 06:25
Compile and run a simple C Hello World app using Docker scratch & Distroless
FROM ubuntu:latest as builder
WORKDIR /build
ADD . /build
RUN apt-get update && apt-get -y install build-essential
RUN gcc -o hello -static -nostartfiles hello.c
# Now copy it into our base image.
FROM gcr.io/distroless/static-debian10

Invoke using Python with pyenv

Requires Python 2.7.x

Using pyenv and the pyenv-virtualenv plugin means you can install the required python version (2.7.x) and packages will not be installed in your global packages, but rather locally in a virtual environment.

cd data_loaders
pyenv local
pyenv -m venv .data
@lantrix
lantrix / dendrite
Created January 31, 2021 13:46
Matrix server dendrite rc.d script for OpenBSD
#!/bin/ksh
daemon="/usr/local/bin/dendrite-monolith-server"
rc_reload=NO
rc_bg=YES
. /etc/rc.d/rc.subr
pexp="/usr/local/bin/dendrite"