Using Karabiner This uses Karabiner (previously called KeyRemap4Macbook) to re-map just the Yubikey device back to QWERTY at the OS-level, but only when you aren't already using QWERTY!
- Install Karabiner.
# frozen_string_literal: true | |
module Authentication | |
# Rodauth is pretty coupled to being in a request context, but this will provide the minimum necessary to be able | |
# to generate correct URLs | |
def self.rodauth(configuration_name = :user, params: {}) | |
url_options = Rails.application.config.action_mailer.default_url_options | |
host = url_options[:host] | |
host += ":#{url_options[:port]}" if url_options.key?(:port) | |
base_url = "#{url_options[:protocol] || 'http'}://#{host}" |
require 'rodauth' | |
module Rodauth | |
# Clean up how we configure all of our tables, columns, etc., to use values which are more consistent with Rails than | |
# the defaults as well as use Rails mailers | |
Feature.define(:rails_conventions, :RailsConventions) do | |
depends :rails # rodauth-rails feature | |
def post_configure | |
# Rodauth uses dash-separated paths by default, so we'll make these underscores by default |
# frozen_string_literal: true | |
require 'rodauth' | |
# Rodauth calls `clear_session` every time it updates the session. This includes when logging in. Unfortunately, this | |
# means that logging in as an admin will log you out as a user, and vice versa. | |
# | |
# This feature introduces a notion of a "scoped" session (inside Rodauth only) that has the following behaviours: | |
# | |
# * Adding a key to the session adds it as a sub-hash, scoped by the configuration name. |
#!/usr/bin/env ruby | |
## NOTE: sometimes (probably because GL can't handle load) the repo is created but the import/migrate fails. | |
## go to <gitea>/admin/repos?sort=size to find 0-byte repos, delete them, and try again. Unfortunately, | |
## deleting these repos (either because of that page or because the repo isn't fully initialised) doesn't | |
## clean up on disk, so I had to manually `rm -rf` them too. | |
require 'json' | |
require 'uri' | |
require 'net/https' |
CREATE EXTENSION IF NOT EXISTS citext; | |
-- http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=1690 | |
CREATE DOMAIN email AS citext | |
CHECK ( | |
VALUE IS NULL OR ( | |
-- is not more than 254 chars | |
length(VALUE) <= 254 AND | |
-- vaguely looks like an email address |
require 'securerandom' | |
require 'base64' | |
module UUID64 | |
extend self | |
def generate | |
encode SecureRandom.uuid | |
end |
require 'command/result' | |
require 'command/result/switch' | |
module Command | |
def self.included(klass) | |
klass.extend Command::ClassMethods | |
end | |
module ClassMethods | |
def call(**options, &block) |
/* | |
* Prevent INSERTs or UPDATEs that introduce NULLs. Useful for when the | |
* table is too big to add NOT NULL constraints without downtime that | |
* can't currently be performed. | |
* | |
* Use like: | |
* | |
* CREATE TRIGGER <name> | |
* AFTER INSERT OR UPDATE | |
* ON <table> |
Postgres does not really fully support unicode the way some users might expect. Unicode (much to some people's chagrin) supports multiple ways of encoding complex characters.
For instance, the character ば
could be:
\u306f\u3099
)\u3070
)Like-wise, á
and á
are different (\u0061\u0301
and \u00e1
).