Skip to content

Instantly share code, notes, and snippets.

View chris-roerig's full-sized avatar
😎
💯

Chris Roerig chris-roerig

😎
💯
View GitHub Profile
@chris-roerig
chris-roerig / update-minecraft-launcher.sh
Created September 4, 2020 20:38
Script to download and install deb packge of Minecraft
#!/bin/bash
# This script will pull the latest Minecraft.deb file from Mojang and install it.
# I put this on a cron to run every week. I created this because I was tired of having
# to update the launcher every time I opened it.
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
@chris-roerig
chris-roerig / readme.txt
Last active February 17, 2021 14:07
how to install bootstrap 4 in Rails 6 via webpacker
# thanks Recker Swartz - https://gorails.com/forum/install-bootstrap-with-webpack-with-rails-6-beta
Updated:
Rails 6 with Bootstrap and configured with Webpack
Step 1:
yarn add bootstrap jquery popper.js
Step 2:
in config/webpack/environment.js add the following:
@chris-roerig
chris-roerig / gist:79777c111374f6356348
Last active October 19, 2020 23:17
How to install NameCheap EssentialSSL wildcard certificate in nginx on Ubuntu 14.04

First generate a new CSR openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr

DO NOT DELETE THE server.key FILE

Follow the rest of this guide after activating the csr and recieving the certs from Namechep.

unzip the package from COMODO

unzip STAR_<yourfqdn_here>_com.zip                                                                               
@chris-roerig
chris-roerig / ruby_macro_methds.rb
Last active July 14, 2020 20:59
How to add macro style methods to a rails model
# Rails Concern
# models/concerns/nicknameable.rb
module Nicknameable
extend ActiveSupport::Concern
included do
def self.nicknames(*args)
define_method("nicknames") { args }
end
nicknames
@chris-roerig
chris-roerig / gist:5b6418a30749021714eb017420b2fc43
Last active May 15, 2020 13:25
rsync backup with 6 day rotation
# copied from http://www.noah.org/engineering/src/shell/rsync_backup
# minor modifications made to support --exclude-from file
#!/bin/sh
#
# This maintains a one week rotating backup. This will normalize permissions on
# all files and directories on backups. It has happened that someone removed
# owner write permissions on some files, thus breaking the backup process. This
# prevents that from happening. All this permission changing it tedious, but it
# eliminates any doubts. I could have done this with "chmod -R +X", but I
@chris-roerig
chris-roerig / 4_27_2020_minetest_lua_docs_api.md
Created April 27, 2020 13:09
Minetest Lua API Documentation
@chris-roerig
chris-roerig / ruby-2_6_0-docs-details.md
Last active June 9, 2019 15:12
Description level Ruby 2.6.0 documentation

    
Simple Access Control Lists.

Access control lists are composed of “allow” and “deny” halves to control access.  Use “all” or “*” to match any address.  To match a specific address use any address or address mask that IPAddr can understand.

Example:
@chris-roerig
chris-roerig / rdm.rb
Created November 8, 2018 18:13
Ruby drum machine
ruby -e "tempo=(60_000/(ARGV[0].to_i||100));start=0;current=(Time.now.to_f*1000).to_i;while true do current=(Time.now.to_f*1000).to_i;if((current-start)>tempo);start=current;print\"\a\";end;end" 120
@chris-roerig
chris-roerig / recipe.rb
Last active October 18, 2018 16:25
Automate vimrc and VundleInstall with Chef
remote_file "/home/chris/.vimrc" do
source "https://raw.githubusercontent.com/chris-roerig/dotfiles/master/vimrc"
owner "chris"
group "chris"
mode "0755"
end
directory "/home/chris/.vim/bundle/" do
owner "chris"
group "chris"
@chris-roerig
chris-roerig / rails_helper.rb
Created March 8, 2018 13:04
DatabaseCleaner rails_helper config
RSpec.configure do |config|
config.use_transactional_fixtures = false
# Use transactions by default
config.before :each do
DatabaseCleaner.strategy = :transaction
end
# For the javascript-enabled tests, switch to truncation, but *only on tables that were used*
config.before :each, :js => true do