Skip to content

Instantly share code, notes, and snippets.

View dwilkins's full-sized avatar

David H. Wilkins dwilkins

View GitHub Profile
@dwilkins
dwilkins / debugi915.sh
Created September 6, 2013 13:55
Script to detect if the Intel i915 graphics card is sick or not. Watch the line about "RC6 residency since boot: NNNNN". If that number doesn't change, then your graphics card is about to go into thermal meltdown
#/usr/bin/sh
function dump_params {
echo -n '# param enable_hangcheck=' ; sudo cat /sys/module/i915/parameters/enable_hangcheck
echo -n '# param fbpercrtc=' ; sudo cat /sys/module/i915/parameters/fbpercrtc
echo -n '# param i915_enable_fbc=' ; sudo cat /sys/module/i915/parameters/i915_enable_fbc
echo -n '# param i915_enable_ppgtt=' ; sudo cat /sys/module/i915/parameters/i915_enable_ppgtt
echo -n '# param i915_enable_rc6=' ; sudo cat /sys/module/i915/parameters/i915_enable_rc6
echo -n '# param invert_brightness=' ; sudo cat /sys/module/i915/parameters/invert_brightness
echo -n '# param lvds_channel_mode=' ; sudo cat /sys/module/i915/parameters/lvds_channel_mode
echo -n '# param lvds_downclock=' ; sudo cat /sys/module/i915/parameters/lvds_downclock
@dwilkins
dwilkins / g_ether.conf
Created April 17, 2016 21:31
Options for the g_ether module
# /etc/modprobe.d/g_ether.conf
options g_ether host_addr=12:a5:cf:42:92:fd dev_addr=5e:bc:ca:27:92:b1 idVendor=1317 idProduct=42146
@dwilkins
dwilkins / users.yml
Created July 11, 2017 20:12
Users fixtures
<% binary_image = File.open("#{Rails.root}/test/fixtures/files/photo-one.png").read %>
<% image_uid = Dragonfly.app.store(binary_image) %>
<% image_name = Dragonfly.app.fetch(image_uid).name %>
john_doe:
username: jdoe
email: 'jdoe@exampmle.com'
first_name: John
last_name: Doe
photo_uid: image_uid
photo_name: image_name
@dwilkins
dwilkins / user.rb
Created July 11, 2017 20:09
User Model
class User < ActiveRecord::Base # model
dragonfly_accessor :photo
end
#!/bin/bash
# Process a compressed rails log file and sort the SQL
# statements by frequency
# Requires - gzip, ansifilter, sed
echo $ARGC
COMMANDNAME=`basename $0`
if [ $# -lt "1" ]
then
@dwilkins
dwilkins / enable_forwarding_masq
Created April 17, 2016 21:45
Enable Forwarding and Masq on the host linux computer
sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
# /etc/dhcpd.conf
#
# Configuration for g_ether / usbpizero
# Only serves 1 address to the computer on the
# other end of the USB cable
# also referenced in /etc/netctl/usbpizero
#
subnet 192.168.7.0 netmask 255.255.255.0 {
range 192.168.7.150 192.168.7.150;
netctl enable usbpizero
systemctl start dhcpd4
# /etc/modules-load.d/raspberrypi.conf
bcm2708-rng
snd-bcm2835
dwc2
g_ether
# /boot/config.txt
# See /boot/overlays/README for all available options
gpu_mem=64
dtoverlay=dwc2