Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lucascaton's full-sized avatar

Lucas Caton lucascaton

View GitHub Profile
@GlenCrawford
GlenCrawford / schema_dumper.rb
Created April 17, 2020 13:59
Patching Rails database schema dumps to support multiple PostgreSQL schemas.
# 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 September 22, 2020 09:48
Haml to erb converter with herbalizer
#!/usr/bin/env ruby
require "httparty"
class Converter
def initialize(filename)
@content = File.open(filename).read
end
attr_reader :content
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 April 29, 2021 07:26
Parse Heroku DB URL into Spring Boot Datasource Environment Variables
# 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 April 16, 2024 02:18
The Simplest Terraform with Docker on macOS

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 January 1, 2017 22:20
Unit file for unicorn
[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 November 17, 2016 06:20
after multiple requests to share my themes for various slack channels. here they are.

NetEngine

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

TriggerApp

#0070ff,#157be8,#2b92ff,#FFFFFF,#1c49ba,#FFFFFF,#5eff00,#de4d2c
require 'RMagick'
require 'capybara'
require 'launchy'
module Capybara::Recording
def start_recording
system "rm -f tmp/*"
end
def save_recording
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 February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}