Skip to content

Instantly share code, notes, and snippets.

@jamescmartinez
jamescmartinez / ruby-on-raspbian.md
Last active Nov 8, 2018
Script to Install Latest Ruby on Raspberry Pi (Raspbian)
View ruby-on-raspbian.md
# Install asdf, our Ruby version manager
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc

# Install dependencies (source: https://github.com/asdf-vm/asdf/blob/master/README.md)
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
jamescmartinez / trackday_checklist.md
Last active Aug 13, 2019
My checklist for trackdays and races
View trackday_checklist.md

Week Before

  • Inspect Motorcycle
  • Purchase Track Day / Register for Race

Motorcycle

  • Motorcycle
  • Motorcycle Key
  • Tools
  • Oil Funnel
  • Zip Ties
@jamescmartinez
jamescmartinez / githubssh.sh
Created Mar 25, 2016
Because setting up SSH on GitHub shouldn't take 10 pages of tutorials...
View githubssh.sh
ssh-keygen -t rsa -b 4096 -C "YOUR_EMAIL_HERE@EXAMPLE.COM"
pbcopy < ~/.ssh/id_rsa.pub
@jamescmartinez
jamescmartinez / html5boilerplate.html
Created Mar 17, 2016
Super simple, no frills HTML5 boilerplate!
View html5boilerplate.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello, World!</title>
<link rel="stylesheet" href="stylesheet.css">
</head>
<body>
Hello, World!
<script src="javascript.js"></script>
@jamescmartinez
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 https://api.slack.com/web#authentication 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 = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@jamescmartinez
jamescmartinez / snapchat_decrypt.rb
Last active Oct 1, 2020
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 = File.open('blob', 'r:ASCII-8BIT').read
c = OpenSSL::Cipher.new('AES-128-ECB')
c.decrypt
c.key = 'M02cnQ51Ji97vwT4'
o = ''.force_encoding('ASCII-8BIT')
data.bytes.each_slice(16) { |s| o += c.update(s.map(&:chr).join) }
@jamescmartinez
jamescmartinez / gitignore_update.sh
Created Dec 10, 2012
Run this script to have your git repo reflect your new (or newly updated) .gitignore file
View gitignore_update.sh
#!/bin/bash
# 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!