Skip to content

Instantly share code, notes, and snippets.

View brand-it's full-sized avatar
🌴

Brandt Lareau brand-it

🌴
View GitHub Profile
@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
@brand-it
brand-it / .irbrc
Last active November 7, 2023 06:39
.irbrc with a bunch of stuff I found useful. This is all sort of hacky but that kinda of the point. Do what you want take what you need. no need to be perfect
# frozen_string_literal: true
MAX_COLUMNS_FOR_TABLE = 15 unless defined?(MAX_COLUMNS_FOR_TABLE)
DEFAULT_EDITOR = 'code' unless defined?(DEFAULT_EDITOR)
class PrettyString < String
# https://no-color.org/
NO_COLOR = ENV.key?('NO_COLOR') || `tput colors`.chomp.to_i < 8 unless defined?(NO_COLOR)
unless defined?(ANSI_COLORS)
ANSI_COLORS = {
red: 31,
#!/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 / install
Last active September 7, 2022 16:25
A simple tool to run rubocop on files you have changed
echo "Creating $(git rev-parse --git-dir)/hooks/pre-commit.d"
mkdir $(git rev-parse --git-dir)/hooks/pre-commit.d
echo "Downloading rubocop hook into $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop"
wget -O $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop https://gist.githubusercontent.com/brand-it/93d04c839238283e3e756811b9c9cee0/raw/616bf812b58bcefc52d564ed8abacbf30966193c/pre-commit.d_rubocop
echo "Changing rubocop into a executable $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop"
chmod 755 $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop
echo "adding hooks_directory variable to $(git rev-parse --git-dir)/hooks/pre-commit if it does not already exist"
grep -qxF 'hooks_directory=$(git rev-parse --git-dir)/hooks/pre-commit.d' $(git rev-parse --git-dir)/hooks/pre-commit || echo 'hooks_directory=$(git rev-parse --git-dir)/hooks/pre-commit.d' >> $(git rev-parse --git-dir)/hooks/pre-commit
echo "adding $hooks_directory/rubocop variable to $(git rev-parse --git-dir)/hooks/pre-commit if it do
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'net/http'
require 'open-uri'
require 'tempfile'
require File.expand_path('ruby_bash', __dir__).to_s
options = {}
def format_as_table(header, data)
total_columns = data.first.size
data.insert(0, header) if header
column_widths = total_columns.times.map { |col| data.map { |row| row[col].size }.max }
if header
data.insert(1, Array.new(total_columns, '-').zip(column_widths).map { |a, b| a * b })
end
data.map do |row|
row.zip(column_widths).map do |cell, width|
cell.to_s.ljust(width)
@brand-it
brand-it / pretty_string.rb
Created March 12, 2022 00:52
I don't know who created this origionaly I but I know some one did. I did some googling to find the original but could not.
# PrettyString.new('something').blue
# PrettyString.new('something').red
# PrettyString.new('something').green
# PrettyString.new('something').yellow
# PrettyString.new('something').magenta
# PrettyString.new('something').white
class PrettyString < String
# https://no-color.org/
NO_COLOR = ENV.key?('NO_COLOR') || `tput colors`.chomp.to_i < 8
ANSI_COLORS = {
@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,
@brand-it
brand-it / rubocop_pre_commit_hook
Last active July 21, 2020 15:50 — forked from mpeteuil/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
def files
@files ||= begin
`git diff --staged --name-only --cached`.split("\n").reject do |file|
!File.exists?(file)
end
end
@brand-it
brand-it / create_ssl.sh
Last active June 9, 2022 16:05
This build tinderbox ssl certs for local development. Can be used for other things but. Also designed to add it to Mac credentials
#!/usr/bin/env ruby
require 'fileutils'
require 'tempfile'
# cn = '*.tb.local.vhost'
# server_name = 'dev.tb.local.vhost'
# admin_server_name = 'admin.tb.local.vhost'