Skip to content

Instantly share code, notes, and snippets.

@rosskevin
rosskevin / db.rake
Last active March 6, 2018 05:02
My db.rake with multi-environment db:rebuild and db:truncate. Some strange behavior in ActiveRecord `database_tasks.rb` adds to the confusion. See this StackOverflow post in the comment.
namespace :db do
# Rake::Task['db:load_config'].enhance [:environment]
desc 'Truncate all tables'
task :truncate => :environment do
puts 'Truncating: '
ActiveRecord::Base.connection.tables.each do |table|
unless %w(schema_migrations rails_admin_histories).include? table
@mootpt
mootpt / windows_example.tf
Last active May 17, 2022 16:41
Example using rsadecrypt interpolation function with windows.
# WARNING. DO NOT USE tls_private_key resource like I have done in this example
# Doing so will result in the private key being stored in state. You do not want that
# Instead use an existing key pair and use the file interpolation function to source
# the private key from disk for use in the rsadecrypt interpolation function
resource "tls_private_key" "key" {
algorithm = "RSA"
}
resource "aws_key_pair" "key_pair" {
@malcolmgreaves
malcolmgreaves / git-largest-files
Last active January 10, 2024 12:44 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Updated to use Python 3 by Malcolm Greaves.
#
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch