Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Jackson peteonrails

View GitHub Profile
View database_truncator.rb
# frozen-string-literal: true
class DatabaseTruncator
def self.truncate
skipped = 'schema_migrations'
ActiveRecord::Base.establish_connection
ActiveRecord::Base.connection.tables.each do |table|
puts "Truncating #{table}"
ActiveRecord::Base.connection.execute("TRUNCATE #{table} CASCADE") unless skipped.include?(table) # rubocop:disable Metrics/LineLength
@peteonrails
peteonrails / README.md
Created Jan 4, 2019 — forked from jondkinney/README.md
jondkinney's console vim setup
View README.md

Console VIM and Tmux setup compatible with Mac OS X and Linux.

Installation

Install by running the following command in your terminal:

exec 3<&1;bash <&3 <(curl https://gist.githubusercontent.com/jondkinney/2040114/raw/vim.sh 2> /dev/null)
@peteonrails
peteonrails / Overview
Last active Feb 11, 2017
ASUS z270 Motherboard with Intel onboard controller Fix EEPROM Checksum for e1000 Linux Driver
View Overview
The ASUS z270 motherboard ships with a bug in the firmware that prevents the Linux kernel driver (e1000)
from activating the hardware. The system will boot correctly, but will not activate your network interface
with this error in place.
In order to fix the issue, I followed these steps:
1. Download the latest Intel Linux drivers from https://downloadcenter.intel.com/product/19297/Intel-82573L-Gigabit-Ethernet-Controller
2. Transfer the drivers to the z270 machine with a thumbdrive
3. Patch the linux drivers to ignore the checksum error. See diff below.
4. make, make install the patched driver. Please note, this will taint your kernel We can fix that later.
@peteonrails
peteonrails / Copyright correction
Created Apr 8, 2016
HAMLIB IC-7300 Rig Driver (patches submitted to upstream)
View Copyright correction
@peteonrails
peteonrails / ic7300.rules
Created Apr 2, 2016
UDEV file for ICOM IC-7300
View ic7300.rules
SUBSYSTEM!="tty",GOTO="hamlib_end"
# Bus 004 Device 026: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", TEST!="/dev/ic7300", SYMLINK+="ic7300", MODE="666"
LABEL="hamlib_end"
@peteonrails
peteonrails / lsusb | diff
Created Apr 2, 2016
Icom IC7300 USB device names
View lsusb | diff
< Bus 004 Device 029: ID 08bb:2901 Texas Instruments PCM2901 Audio Codec
< Bus 004 Device 028: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
< Bus 004 Device 027: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
@peteonrails
peteonrails / lsusb.txt
Created Feb 17, 2016
Troubleshoot FT-991 USB interface
View lsusb.txt
~] lsusb -v 9:14:04
Bus 004 Device 010: ID 0b05:179c ASUSTek Computer, Inc.
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 224 Wireless
bDeviceSubClass 1 Radio Frequency
View keybase.md

Keybase proof

I hereby claim:

  • I am peteonrails on github.
  • I am peteonrails (https://keybase.io/peteonrails) on keybase.
  • I have a public key whose fingerprint is FE84 3C89 4168 5E39 32A7 AA20 09B9 F8AD 6B44 9A71

To claim this, I am signing this object:

View handbook.md

[ ] Put signed contact in Dropbox [ ] Create Freshbooks invoice for first 2 weeks [ ] Create Freshbooks recurring invoice to start after week 3 (weekly) [ ] Create Campfire room [ ] Create Github Repo [ ] Create Trello Board (for Product Design Sprints or Rails MVPs, use Trello template) [ ] Create recurring calendar invites for weekly planning, retros, and daily standups [ ] Create project in Team [ ] Share Team project page with client [ ] Schedule thirty minute meeting with client to go over systems

View resque_retry.rb
# inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs
# retry all failed Resque jobs except the ones that have already been retried
# This is, for instance, useful if you have already retried some jobs via the web interface.
Resque::Failure.count.times do |i|
Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present?
end
# retry all :)
Resque::Failure.count.times do |i|