Skip to content

Instantly share code, notes, and snippets.

Avatar

Lucas Caton lucascaton

View GitHub Profile
@GlenCrawford
GlenCrawford / schema_dumper.rb
Created Apr 17, 2020
Patching Rails database schema dumps to support multiple PostgreSQL schemas.
View schema_dumper.rb
# Overrides Rails file activerecord/lib/active_record/schema_dumper.rb to
# include all schema information in the db/schema.rb file, for example, in the
# create_table statements. This allows for a working development database
# to be built from a schema.rb file generated by rake db:schema:dump.
#
# This is essentially a rebuild of the "schema_plus_multischema" gem (which is
# unfortunately only compatible with Rails ~> 4.2).
#
# Tested with Rails 6.0.
@3zcurdia
3zcurdia / haml2erb.rb
Last active Sep 22, 2020
Haml to erb converter with herbalizer
View haml2erb.rb
#!/usr/bin/env ruby
require "httparty"
class Converter
def initialize(filename)
@content = File.open(filename).read
end
attr_reader :content
View Letsencrypt acmev2
sudo ./certbot-auto certonly --manual -d 'example.com' -d '*.example.com' --agree-tos --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory
@wwerner
wwerner / heroku-db-url-to-spring-boot.sh
Last active Apr 29, 2021
Parse Heroku DB URL into Spring Boot Datasource Environment Variables
View heroku-db-url-to-spring-boot.sh
# Two possibilities to parse a Postgres DB URL from heroku into environment variables
# that Spring Boot understands.
# You would need that, if you do not build on heroku but push docker images
# from another source
# Does not need bash. Works on alpine linux / busybox. Tested with openjdk:8-jdk-alpine base image.
export DATABASE_URL=postgres://user:password@host:port/database
# Naive way, would break with [@:/] in username or password.
DB_TYPE=$(echo $DATABASE_URL | awk -F'[:@/]' '{print $1}')"ql"
@brianshumate
brianshumate / docker-macos-terraform.md
Last active Jan 25, 2022
The Simplest Terraform with Docker on macOS
View docker-macos-terraform.md

If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

@duderamos
duderamos / unicorn.service
Last active Jan 1, 2017
Unit file for unicorn
View unicorn.service
[Unit]
Description=Unicorn Server
Requires=redis.service
Wants=mysqld.service postgresql.service
After=redis.service mysqld.service postgresql.service
[Service]
Type=forking
User=netengine
WorkingDirectory=/var/www/unicorn/current
@johnpmorris
johnpmorris / Slack-Themes.md
Last active Nov 17, 2016
after multiple requests to share my themes for various slack channels. here they are.
View Slack-Themes.md

NetEngine

#06a8f9,#1897d6,#ffffff,#06a8f9,#1897D6,#ffffff,#15ff00,#FF8669

TriggerApp

#0070ff,#157be8,#2b92ff,#FFFFFF,#1c49ba,#FFFFFF,#5eff00,#de4d2c
View capybara-recording.rb
require 'RMagick'
require 'capybara'
require 'launchy'
module Capybara::Recording
def start_recording
system "rm -f tmp/*"
end
def save_recording
View github_labels_manager.rb
require 'octokit'
client = Octokit::Client.new login: 'username', password: 'password'
repos = []
page = 1
loop do
puts "Fetching repositories from page ##{page}"
@imjasonh
imjasonh / markdown.css
Last active Jan 2, 2022
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}