Skip to content

Instantly share code, notes, and snippets.

View ryansch's full-sized avatar

Ryan Schlesinger ryansch

View GitHub Profile
@ryansch
ryansch / openpgp.md
Created August 15, 2023 18:53
keyoxide

openpgp4fpr:8D63C79F5EEF5688A6D33ABFBD9E30D205AB53BA

@ryansch
ryansch / thor_help.rb
Created June 28, 2023 12:54
ThorHelp (doesn't work with required options)
module ThorHelp
# This adds a --help option to all Thor commands.
def self.included(base)
base.class_eval do
class_option :help,
type: :boolean,
aliases: ["-h"],
desc: "Describe command"
@ryansch
ryansch / .envrc
Created May 11, 2023 12:16
minimal ruby+bundle repro
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="
use devenv
@ryansch
ryansch / link_multiple_switches.yaml
Last active March 12, 2023 09:37 — forked from aderusha/link_multiple_switches.yaml
Home Assistant Blueprint: Link Multiple Switches v1.0.1
@ryansch
ryansch / Dockerfile
Last active February 15, 2023 17:03
Install nodejs in docker debian/ubuntu
FROM hexpm/elixir:some_version
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
# Install nodejs
RUN set -eux; \
\
apt-get update; \
apt-get install -y \
@ryansch
ryansch / unifi-ssh
Created January 30, 2023 23:43
Enable old SHA-1 based rsa stuff for unifi
#!/bin/bash
set -euo pipefail
exec ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa "$@"
@ryansch
ryansch / README.md
Last active November 3, 2022 20:27
attr_encryption -> Active Record Encryption

This is designed to work with https://github.com/PagerTree/attr_encrypted/tree/rails-7-0-support as attr_encrypted normally can't coexist with Rails 7.

It will allow you to add encrypts and migrate_encryption_for to your models, migrate, and finally remove everything but the encrypts lines.

You probably also want to set

config.active_record.encryption.key_provider = ActiveRecord::Encryption::EnvelopeEncryptionKeyProvider.new

in application.rb.

@ryansch
ryansch / Dockerfile.cloudflared
Last active May 13, 2022 22:16
Pihole Install
FROM ubuntu:jammy
LABEL maintainer="Ryan Schlesinger <ryan@ryanschlesinger.com>"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
RUN set -eux; \
\
apt-get update -y; \
apt-get install -y \
@ryansch
ryansch / install.sh
Created February 6, 2022 18:35
Homebrew install w/ arm64 linux check removed.
#!/bin/bash
# We don't need return codes for "$(command)", only stdout is needed.
# Allow `[[ -n "$(command)" ]]`, `func "$(command)"`, pipes, etc.
# shellcheck disable=SC2312
set -u
abort() {
printf "%s\n" "$@"
@ryansch
ryansch / launch.sh
Last active May 19, 2021 17:04
Launch a linode from an image
#!/bin/bash
# On macos, this script's deps can be installed with:
# brew install jq python3
# pip3 install linode-cli
# If on another platform, remove the call to pbcopy at the end of the script.
set -euo pipefail