Skip to content

Instantly share code, notes, and snippets.

View mriddle's full-sized avatar

Matthew Riddle mriddle

View GitHub Profile
@mriddle
mriddle / repository_archiving_report.rb
Last active October 12, 2022 20:05
List of all unarchived repositories within organization using the GitHub GraphQL API. Requires a PAT (Personal Access Token) that has the necessary privileges
#!/usr/bin/env ruby
# List of all unarchived repositories within organization
# - group by year last updated
# - exclude those updated in the last 12 months
#
# Requires a GitHub Personal Access Token with the `repo` scope
# and it will need be authorized with with SSO where applicable.
#
# Pass token in via the GITHUB_ACCESS_TOKEN environment variable
@mriddle
mriddle / Rails dependency finder
Last active August 28, 2022 17:50
Find dependencies that need to be bumped for a Rails upgrade: check_rails_dependancies.rb -v 6.1.0
# Example usage
$ ./check_rails_dependencies.rb --version 6.1.0
------------------------------
93 dependencies using Rails
------------------------------
action_mailer-logged_smtp_delivery v2.1.0
✗ actionmailer
actionpack-action_caching v1.2.0
✓ actionpack
✓ activerecord

Minecraft on Apple Silicon

In this gist, you can find the steps to run Minecraft 1.16.4 natively on Apple Silicon (AS), without needing Rosetta 2 translation of the dependencies (mainly LWJGL and related libraries).

While it's possible to use a launcher like MultiMC to have a prettier way to run the game on AS, it requires installing even more dependencies (like QT) which take time and are difficult to distribute. Therefore, I've put together a command line-based launcher tool using a couple shell & Python scripts.

To get up and running quickly, follow the steps below. Otherwise, for more detail, watch my YouTube video.

Download my package

@mriddle
mriddle / jenkins_copying_configuration.sh
Created November 9, 2012 03:13
Moving Jenkins server configuration from one server to another
ORIGINAL_JENKINS_SERVER=
ORIGINAL_SERVER_USER=
NEW_JENKINS_SERVER=
NEW_SERVER_USER=
# ON THE ORIGINAL JENKINS SERVER
ssh $ORIGINAL_SERVER_USER@$ORIGINAL_JENKINS_SERVER
cd /var/lib/jenkins/
for i in `ls jobs`; do echo "jobs/$i/config.xml";done > config.totar
@mriddle
mriddle / query_tracer.rb
Created March 24, 2020 10:21
Log slow queries in Rails
class QueryTracer < ActiveSupport::LogSubscriber
ACCEPT = %r{^(app|config|lib)}.freeze
FRAMES = 15
THRESHOLD = 100 # In ms
def sql(event)
return unless event.duration > THRESHOLD
callers = Rails.
backtrace_cleaner.
@mriddle
mriddle / knife_basics.md
Last active July 20, 2019 19:09
Using knife

Using Knife

Basic configuration

How to knife the chef

  • Uploading cookbooks
    knife cookbook upload -a
    Will upload all cookbooks
  • Updating cookbooks from source
    knife cookbook site vendor cookbook_name # e.g. jenkins
  • Adding roles knife role from file path/filename.ext #e.g. roles/jenkins_node.json
@mriddle
mriddle / config
Created April 8, 2019 05:47
"~/.bundle/config"
BUNDLE_PATH: "./vendor/bundle"
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_JOBS: "8"
BUNDLE_GEM__TEST: "rspec"
BUNDLE_GEM__MIT: "true"
BUNDLE_GEM__COC: "false"
module Helpers
class Range
def self.merge_overlapping_ranges(ranges)
ranges.sort_by(&:begin).inject([]) do |collection, range|
if !collection.empty? && overlap?(collection.last, range)
collection[0...-1] + [merge(collection.last, range)]
else
collection + [range]
end
end
@mriddle
mriddle / knife.rb
Created November 8, 2012 20:56
Basic knife configuration for chef server
### Chef Knife config example
# https://github.com/fnichol/chef-bootstrap-repo/blob/master/.chef/knife.rb
###
# Environment variables required:
# CHEF_SERVER_URL - IP or url of your chef server
# CHEF_USER - Initial user
# AWS_ACCESS_KEY - AWS Access ID found here https://portal.aws.amazon.com/gp/aws/securityCredentials
# AWS_SECRET_KEY - AWS Secrete key found in link above
@mriddle
mriddle / sublime_config.pp
Last active August 21, 2018 22:06
My Boxen puppet-sublime config
class config::sublime {
define addpkg {
$packagedir = "/Library/Application Support/Sublime Text 2/Packages/"
$pkgarray = split($name, '[/]')
$pkgname = $pkgarray[1]
exec { "git clone https://github.com/${name}.git":
cwd => "/Users/${::luser}${packagedir}",
provider => 'shell',