Skip to content

Instantly share code, notes, and snippets.

View andyjeffries's full-sized avatar

Andy Jeffries andyjeffries

View GitHub Profile
@andyjeffries
andyjeffries / plugins.md
Last active August 17, 2025 17:00
Omarchy plugin concept

Omarchy plugin concept

My thinking is that there are multiple plugins, so that they can be used by companies AND third parties to (for example) support installation of development environments for particular languages, etc.

During installation

During installation you could define a list of plugins. Each plugin can either be a script URL or a GitHub repo. For example:

export OMARCHY_PLUGINS=andyjeffries/omarchy,basecamp/internal,https://omarchy.example.com/install

Running it once:

  INFO [9824c617] Running docker run --detach --restart unless-stopped --name some-web-process-92d82dbc0250bcfa1d86bed17685f67dc0c87012 --network kamal --hostname 1.2.3.4-49ac32e40b0e -e KAMAL_CONTAINER_NAME="some-web-process-92d82dbc0250bcfa1d86bed17685f67dc0c87012" -e KAMAL_VERSION="92d82dbc0250bcfa1d86bed17685f67dc0c87012" --env RAILS_ENV="staging" --env-file .kamal/apps/some-website-staging/env/roles/web.env --log-opt max-size="10m" --volume /storage:/app/storage --volume $(pwd)/.kamal/apps/some-website-staging/assets/volumes/web-92d82dbc0250bcfa1d86bed17685f67dc0c87012:/app/public/assets --label service="some-website" --label role="web" --label destination="staging" example/repo:92d82dbc0250bcfa1d86bed17685f67dc0c87012 on 1.2.3.4
  INFO [9824c617] Finished in 0.785 seconds with exit status 0 (successful).
  INFO [03e088fc] Running docker container ls --all --filter name=^some-web-process-92d82dbc0250bcfa1d86bed17685f67dc0c87012$ --quiet on 1.2.3.4
  INFO [03e088fc] Finished in 0.122
objects = [MyObject.new(name: "John Smith"), MyObject.new(name: "Joan Smith"), MyObject.new(name: "Jane Doe")]
objects.select {|o| o.name["Smith"]}.each do |o|
o.name.gsub!("Smith", "Jones")
o.save
end
@andyjeffries
andyjeffries / output
Created April 15, 2020 11:40
Traefik real IP not working
$ curl env-printer.55726d54-72cd-4564-9c52-e46845c20433.k8s.civo.com ⎈ |prod:default
GET / HTTP/1.1
Host: env-printer.55726d54-72cd-4564-9c52-e46845c20433.k8s.civo.com
User-Agent: curl/7.64.1
Accept: */*
X-Forwarded-For: 192.168.0.8
X-Forwarded-Host: env-printer.55726d54-72cd-4564-9c52-e46845c20433.k8s.civo.com
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: traefik-65bccdc4bd-tkbmn
@andyjeffries
andyjeffries / debugging-setup-vscode.md
Last active November 14, 2019 13:46
How to setup debugging with Ruby on Rails on VS Code

Debugging Ruby on Rails with VS Code

  1. Add to your Gemfile and bundle install --binstubs (then run rails app:update:bin to fix bundler overwriting Rails 5 default bin stub).
group :development do
  gem 'ruby-debug-ide'
  gem 'debase'

  # If you want some nice documentation, 
@andyjeffries
andyjeffries / cloudSettings
Last active November 20, 2020 19:09
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-11-20T19:09:03.523Z","extensionVersion":"v3.4.3"}
@andyjeffries
andyjeffries / Installation.md
Created April 11, 2018 13:24 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@andyjeffries
andyjeffries / .rails-template.rb
Created April 4, 2017 10:47
My Rails template to setup RSpec and Guard and Dokku integration
# Add to the given file the given lines, after the line with the given text, or replace the content
def add_to_file(path, text, after=nil, replace=false)
lines = []
if replace
lines = text
else
File.readlines(path).each do |line|
if after != nil and line.include?(after)
lines << line
lines << text
@andyjeffries
andyjeffries / .railsrc
Created April 4, 2017 10:45
My .railsrc to disable CoffeeScript and Turbolinks
--database=mysql
--skip-coffee
--skip-turbolinks
--template=~/.rails-template.rb
@andyjeffries
andyjeffries / loc.rb
Last active January 20, 2017 08:40
Lines of code
#!/usr/bin/ruby
def count_lines(filename, type)
lines = File.read(filename).force_encoding('BINARY').split("\n")
lines.delete_if {|line| line[/^\s*$/]}
case type
when :ruby
lines.delete_if {|line| line[/^\s*#/]}
when :go
lines.delete_if {|line| line[/^\s*\/\/$/]}