Skip to content

Instantly share code, notes, and snippets.

View cannikin's full-sized avatar
🔨
Woodworking

Rob Cameron cannikin

🔨
Woodworking
View GitHub Profile
https://docs.google.com/document/d/1-g1Roz85tbSE58Ob8kS_QAl5RYVnoNqKRjAL2_NvXzY/edit?usp=sharing
diff --git a/yarn.lock b/yarn.lock
index e8c899e..0592224 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -907,7 +907,7 @@
pirates "^4.0.0"
source-map-support "^0.5.16"
-"@babel/runtime-corejs3@^7.8.3", "@babel/runtime-corejs3@^7.8.4":
+"@babel/runtime-corejs3@^7.7.4", "@babel/runtime-corejs3@^7.8.3", "@babel/runtime-corejs3@^7.8.4":
<script type="text/javascript">
var since = '<%= @since.to_f %>';
var updater = setInterval( function() {
new Ajax.Updater('notes','/poller', {
method:'get',
parameters:"since="+since,
insertion:'top',
onSuccess:function(r) { since = r.responseText; }
})
}, 4000);
@cannikin
cannikin / epub_cover_fixer.rb
Created March 31, 2019 18:08
Fixes cover images for IDW's Transformers Humble Bundle epub: https://www.humblebundle.com/books/transformers-2019-idw-books
# Fixes cover images in epub files
# Run this file wherever you want, just change the path in the last line to a directory containing all your epub files.
class EpubCoverFixer
class MetaTagNotFound < StandardError; end
attr_reader :starting_dir
def initialize(dir)
@cannikin
cannikin / README.md
Last active March 28, 2019 16:08
Typical Ruby on Rails AWS Server Setup

Typical Ruby on Rails AWS Server Setup

You should be able to start a fresh EC2 instance of Ubuntu and follow the instructions below to get a server with your preferred version of Ruby, nginx ready to delegate requests to Unicorn, and logrotate setup to keep your disk from filling up with log files. You will also have ruby-install for installing new rubies and chruby for switching between them. A .ruby-version file will be added to the home directory of the user that runs this script.

Install

  1. Start an EC2 instance using the latest Ubuntu image (as of 2015-06-18 ami-5189a661 for EBS, 64-bit SSD)
  2. Copy the config files below into /tmp using the file names specified in the title.
  3. Edit /tmp/setup.sh and change the variables at the top to match your setup
  4. Make /tmp/setup.sh executable: chmod +x /tmp/setup.sh
@cannikin
cannikin / gist:abb686146972a6716764
Created June 22, 2015 22:56
Git pre-commit hook for Ruby/Javascript debugging statements
#!/bin/sh
FILES='(js|css|rb|haml|erb)'
FORBIDDEN='(binding.pry|console.|debugger)'
GREP_COLOR='4;5;37;41'
if [[ $(git diff --cached --name-only | grep -E $FILES) ]]; then
git diff --cached --name-only | grep -E $FILES | \
xargs grep --color --with-filename -n -E $FORBIDDEN && \
printf "\nLooks like you are trying to commit something you shouldn't. Please fix your diff, or run 'git commit --no-verify' to skip this check, if you must." && \
@cannikin
cannikin / deploy.rb
Last active October 22, 2018 09:02
Notify Sentry of a new release via Capistrano
# This task will notify Sentry via their API[1] that you have deployed
# a new release. It uses the release timestamp as the `version`
# (like 20151113182847) and the git ref as the optional `ref` value.
#
# This task requires several environment variables be set (or just
# hardcode the values in here if you like living on the edge):
#
# ENV['SENTRY_API_ENDPOINT'] : API endpoint, https://app.getsentry.com
# ENV['SENTRY_ORG'] : the organization for this app
# ENV['SENTRY_PROJECT'] : the project for this app
rtl_fm, a simple narrow band FM demodulator for RTL2832 based DVB-T receivers
Use: rtl_fm -f freq [-options] [filename]
-f frequency_to_tune_to [Hz]
use multiple -f for scanning (requires squelch)
ranges supported, -f 118M:137M:25k
[-M modulation (default: fm)]
fm, wbfm, raw, am, usb, lsb
wbfm == -M fm -s 170k -o 4 -A fast -r 32k -l 0 -E deemp
raw mode outputs 2x16 bit IQ pairs
@cannikin
cannikin / rails_version.rb
Last active February 16, 2018 19:10
Two different forms of `include` in Ruby, only one of which works as expected
class BustedInclude
include ActiveModel::Validations, ActiveModel::Validations::Callbacks
before_validation { puts 'Callback!' }
end
# outputs only `true`
instance = BustedInclude.new
instance.valid?
class WorkingInclude
@cannikin
cannikin / email.txt
Created July 19, 2017 02:06
ComicCon 2017 Registration Email
Comic-Con 2017 Open Registration launches shortly after 9:00 AM Pacific Daylight Time (PDT) on April 8, 2017! Below you will find the link to the Expo Logic waiting room and your personal registration code. The waiting room will open at 8:00 AM PDT for registration code authorization. Comic-Con 2017 Open Registration will begin shortly after 9:00 AM PDT. The Expo Logic waiting room will close for entry at 9:00 AM PDT sharp.
Expo Logic Waiting Room: http://oorel17cci.cloudapp.net/
Registration Code: JKRR6VZF246XNTL
Please click the link above to access the Expo Logic waiting room on April 8, 2017. You must authorize your registration code for entry prior to 9:00 AM PDT.
There is no need to rush to the landing page at 8:00 AM PDT! Attendees will be randomly selected for badge purchase. There is no advantage in arriving early. We suggest that you arrive 10 – 15 minutes before 9:00 AM PDT to avoid unnecessary waiting time.