Skip to content

Instantly share code, notes, and snippets.

jamescmartinez / eq_time.rb
Created Oct 22, 2021
RSpec time comparison matcher to 6 decimal places
View eq_time.rb
# On MacOS, time has a precision of 6. On Linux (e.g. CI), time is more precise.
# For example:
# Linux: Fri, 22 Oct 2021 11:24:40.219256519 UTC +00:00
# MacOS: Fri, 22 Oct 2021 11:24:40.219256000 UTC +00:00
# This matcher compares time with a precision of 6 decimal places to prevent
# time comparison failures in CI.
RSpec::Matchers.define(:eq_time) do |expected|
jamescmartinez /
Last active Jun 15, 2022
Script to Install Latest Ruby on Raspberry Pi (Raspbian)
# Install asdf, our Ruby version manager
git clone ~/.asdf
echo -e '\n. $HOME/.asdf/' >> ~/.bashrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc

# Install dependencies (source:
sudo apt-get update
sudo apt-get install automake autoconf libreadline-dev libncurses-dev libssl-dev libyaml-dev libxslt-dev libffi-dev libtool unixodbc-dev
jamescmartinez /
Last active Aug 13, 2019
My checklist for trackdays and races

Week Before

  • Inspect Motorcycle
  • Purchase Track Day / Register for Race


  • Motorcycle
  • Motorcycle Key
  • Tools
  • Oil Funnel
  • Zip Ties
jamescmartinez /
Created Mar 25, 2016
Because setting up SSH on GitHub shouldn't take 10 pages of tutorials...
ssh-keygen -t rsa -b 4096 -C "YOUR_EMAIL_HERE@EXAMPLE.COM"
pbcopy < ~/.ssh/
jamescmartinez / html5boilerplate.html
Created Mar 17, 2016
Super simple, no frills HTML5 boilerplate!
View html5boilerplate.html
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Hello, World!</title>
<link rel="stylesheet" href="stylesheet.css">
Hello, World!
<script src="javascript.js"></script>
jamescmartinez / slack_delete.rb
Last active Jan 4, 2021
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from into the token quotes at the top of the file.
View slack_delete.rb
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = ( - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
jamescmartinez / snapchat_decrypt.rb
Last active Nov 18, 2022
Snapchat Image Decrypt - This Ruby script decrypts the blob received from the `bq/blob` endpoint. Many thanks to @kivikakk, @adamcaudill, @tlack, and @NeilHanlon for inspiration, code, guides, and of course, the encryption key.
View snapchat_decrypt.rb
#!/usr/bin/env ruby
require 'openssl'
data ='blob', 'r:ASCII-8BIT').read
c ='AES-128-ECB')
c.key = 'M02cnQ51Ji97vwT4'
o = ''.force_encoding('ASCII-8BIT')
data.bytes.each_slice(16) { |s| o += c.update( }
jamescmartinez /
Created Dec 10, 2012
Run this script to have your git repo reflect your new (or newly updated) .gitignore file
# Please be aware to commit all your changes before; YOU WILL LOSE ALL CHANGES SINCE LAST COMMIT!
git rm -r --cached . # This removes everything from the index.
git add . # Add everything back using new .gitignore
git commit -m ".gitignore is now working" # Commit it!