Skip to content

Instantly share code, notes, and snippets.

View brand-it's full-sized avatar

Brandt Lareau brand-it

View GitHub Profile
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@kylophone
kylophone / loudness.rb
Last active January 3, 2025 18:00
FFmpeg loudnorm filter - dual pass loudness normalization example - http://k.ylo.ph/2016/04/04/loudnorm.html
#!/usr/bin/env ruby
require 'open3'
require 'json'
ffmpeg_bin = '/usr/local/bin/ffmpeg'
target_il = -24.0
target_lra = +11.0
target_tp = -2.0
samplerate = '48k'
@GiantWaffleCode
GiantWaffleCode / 1.12 GW Reactor
Last active November 12, 2024 00:45
Factorio Strings
0eNrs3d2uHUeWGOhXafBaasTvWrELMxeG4RkMYLiBHnt8YTQESmJVES2JMkW1XdOoB/B7zLyYn2TOOZTEoyqGdnxZY1S5u9FAtQ55YjEyV0Rm5Jex1/7HF59/9f2rb9++/ubdi1/944vXX7z55rsXv/pP//jiu9e/+eblV49/9s3Lr1+9+NWLb77/4qtXL99++vbVyy/evXn74vefvHj9zZev/uuLX9Xf/90nL1598+71u9ev3jd++uF3n33z/defv3r78Auf/Bjk29ffvvr03ZtPf/P2zffffPnikxffvvnuodmbbx7/oYdQrd3+en7y4ncvfvVpG+uv58M/8uXrt6++eP8r6/ef/FHs9rPYfxyx3vJDxIf//P1HYvTj/v0sWnw82oBo6+d9+9nR1vaR4PP8VJb8heDjI7EDYnPH8zx4XdjxBbFv2vHbnQH2syG7GWC1wAzQo68wvXrRw68fJtjbN5+/+fbN23cfixs/RX2I+fbVf/7+1XfvPvv166/evXr73eMvfff+H3l/efjxuvHJi59+42d/+sO/99Wb37z+7t3rLz59/Icf/9X//P3Lrx769ngxevP264er0ycvvnjz9bcv3758vCD96sX/+vQH3z9eymb5/d89/N/HDuh8trdR+XQNiF400zD7Z9XgMP1n4/MC8z86R4crQDQ9Mbfz4NkxeCv3Li857l5eGlwBnofb3MDahyn/5asvXn/56u2nD9Ps89ffPE2zj0z+/mPA8cfZepyR37x7++arzz5/9duX//D6caL+449xP3v4uy9f/3Bh+McXz396uCD8+vXbh4vIh4XIu999+9inf3j99t33T5P/h06+/41P//3jkuRx/fLu5dMVYJY/uDz89//2/7x4PNw/jPtDmO/fvvzm9fdff/rr71999ekXr7766n28P7q+PP7Bq89+6MzLh5P8uPx58/27b79/94dLpzs9/s3bV6++ef+vfPu7z56uXJ/9+u2brz97/c1DsBe/+vXLr7579XgV+1iSPlzGvn7
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active August 30, 2024 08:37
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@pdfrod
pdfrod / decode_session_cookie.rb
Last active July 4, 2024 14:20 — forked from profh/decode_session_cookie.rb
A simple script to decode Rails 4 session cookies
@abriening
abriening / application_controller.rb
Created September 30, 2011 21:42
Add support for handling 405 Method Not Allowed & 501 Not Implemented
# As used with CanCan and Devise
class ApplicationController < ActionController::Base
protect_from_forgery
include ErrorResponseActions
rescue_from CanCan::AccessDenied, :with => :authorization_error
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
before_filter :authenticate!
@JeffBelback
JeffBelback / docker-destroy-all.sh
Last active May 25, 2024 20:19
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
fi
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
@IanVaughan
IanVaughan / uninstall_gems.sh
Created June 9, 2012 20:37
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'uri'
require 'json'
require 'net/http'
require 'optparse'
require 'forwardable'
COMMAND_NAME = File.basename(__FILE__)
@brand-it
brand-it / logger.rb
Last active March 5, 2024 19:59
logger for scripting
# A nice way to add color to strings
class PrettyString < String
# https://no-color.org/
NO_COLOR = ENV.key?('NO_COLOR') || `tput colors`.chomp.to_i < 8
ANSI_COLORS = {
white: 0,
red: 31,
green: 32,
yellow: 33,
blue: 34,