Skip to content

Instantly share code, notes, and snippets.

View n3bulous's full-sized avatar

Kevin McFadden n3bulous

View GitHub Profile
@wndxlori
wndxlori / send_to_kindle.rb
Last active April 15, 2024 20:00
When you have a whole LOT of ebooks to send to your Kindle
#!/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
@AliOsm
AliOsm / .env
Last active April 17, 2024 17:18
Deploy Rails, GoodJob, PostgreSQL, Redis, Memcached, Meilisearch, and ChromaDB on the same server using Kamal.
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
@jjb
jjb / file.md
Last active May 9, 2024 06:26
Using Jemalloc 5 with Ruby.md

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.

Ubuntu/Debian

FROM ruby:3.1.2-bullseye
RUN apt-get update ; \
@natematykiewicz
natematykiewicz / migrate-sidekiq-redis.rb
Last active February 21, 2024 17:18
Migrate Sidekiq Redis
# 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 = []
@palkan
palkan / README.md
Created January 24, 2022 13:29
Rails boot time profiling

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 &lt;&lt; [event.payload[:initializer], event.duration]
@IwoHerka
IwoHerka / naming_guidelines.md
Last active April 1, 2024 15:39
Naming Guidelines

Naming guidelines

1. Syntax

1.1 Be consistent

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.

1.2 Follow conventions

@protosam
protosam / Minikube for Mac Users.md
Last active March 8, 2022 22:50
Notes for switching from Docker Desktop to Minikube

With Docker Desktop becoming more restricted, I've decided to move on to just using minikube. In doing so, I've consolidated my notes as follows.

Installation

Use brew to install the docker cli and minikube.

$ brew install minikube docker kubectl hyperkit

Running Minikube

The first time you start minikube, you should specify any settings you desire.

@aussielunix
aussielunix / Day0.md
Last active July 29, 2023 21:32
Runsheet for bootstrapping a clean MacOS M1 using https://github.com/geerlingguy/mac-dev-playbook

Day 0 - Bootstrap MacOS with Ansible

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"
@bxparks
bxparks / parseflags.sh
Last active February 21, 2024 12:07
Simple Bash Shell Command Line Processing Template
#!/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() {