Sources for my blog post about terminal–based game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Usr/bin/env ruby | |
require 'mail' | |
require 'fileutils' | |
# Check if a command line argument is provided | |
if ARGV.length < 1 | |
puts "Usage: ruby send_to-kindle.rb <directory containing epub files>" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KAMAL_REGISTRY_PASSWORD=dckr_pat_xXXxx_x0xXxXx-xX-XXX0xX0x-x | |
RAILS_MASTER_KEY=00x00xxx000xxx000000xx0x000x0x00 | |
POSTGRES_PASSWORD=xXxxx0xXXx0 | |
MEILI_MASTER_KEY=xXxxx0xXXx0 | |
BLAZER_DATABASE_URL=postgres://service:{POSTGRES_PASSWORD}@service-name-postgres:5432/service_production |
For years, people have been using jemalloc with ruby. There were various benchmarks and discussions. Legend had it that Jemalloc 5 didn't work as well as Jemalloc 3.
Then, one day, hope appeared on the horizon. @wjordan offered a config for Jemalloc 5.
FROM ruby:3.1.2-bullseye
RUN apt-get update ; \
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A script to migrate Sidekiq's redis to a new server. | |
# This obviously can work for any redis, but I only handled | |
# data types that Sidekiq uses. | |
require 'redis' | |
old_redis = Redis.new url: 'redis://old-redis:6379' | |
new_redis = Redis.new url: 'redis://new-redis:6379' | |
unknowns = [] |
Add the following to application.rb
:
$icallbacks = []
$icallbacks.define_singleton_method(:print) do
puts sort_by { |(a, b)| -b }.map { |(a, b)| "#{b}\t\t#{a}" }.join("\n")
end
ActiveSupport::Notifications.subscribe("load_config_initializer.railties") do |event|
$icallbacks << [event.payload[:initializer], event.duration]
Consistency in naming makes reading and memory retrieval much, much easier. Conversely, changing rules and mixing conventions are very confusing and significantly increase cognitive load. Follow language, company, and project conventions for names, even if you don't like them.
After factory resetting the maching you will need to do the following things to bootstrap it with Ansible.
- Set default shell to bash
chsh -s /bin/bash
(optional) - Open the App Store and sign in (but do not install anything)
- Install command line tools
xcode-select --install
- Add Python 3.8 to the $PATH
export PATH="$HOME/Library/Python/3.8/bin:$PATH"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Self-contained command line processing in bash that supports the | |
# minimal, lowest common denominator compatibility of flag parsing. | |
# -u: undefined variables is an error | |
# -e: exit shell on error | |
set -eu | |
function usage() { |
NewerOlder