Skip to content

Instantly share code, notes, and snippets.

View dwilkins's full-sized avatar

David H. Wilkins dwilkins

View GitHub Profile
@dwilkins
dwilkins / 20-intel.conf
Last active December 22, 2015 11:18
X11 Config file for Fedora 19 (et. al.) that keeps the graphics card from going into thermal meltdown
# file: /etc/X11/xorg.conf.d/20-intel.conf
# source: https://wiki.archlinux.org/index.php/Intel_Graphics#Choose_acceleration_method
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "uxa"
EndSection
@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
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"
xmlns:geo="http://www.google.com/geo/schemas/sitemap/1.0"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"
xmlns:pagemap="http://www.google.com/schemas/sitemap-pagemap/1.0"
@dwilkins
dwilkins / tobrowser.sh
Created August 14, 2013 02:26
gstreamer to browser (uses vlc plugin though)
Ok. Here is the sending side.
This is specialized for our strange needs, it may not right right for
others.
I don't have access to receiving side. Maintained by somebody else, and
part of a complicated web app.
But you can invoke VLC directly to catch this video. Just point it at the
URL.
Be warned that most routers do not properly handle multicast data.
#!/bin/bash
@dwilkins
dwilkins / database.yml
Created August 13, 2013 22:26
When deploying to Openshift this is what the database.yml should look like
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
@dwilkins
dwilkins / resizeit.sh
Last active December 20, 2015 23:18
Resize images and use the tileup gem to slice them up for a slippy map
imagename=$1
imagebasename=${imagename%.*}
size=512
for size in 512 1024 2048 4096 8192 16384
do
echo "Resizing to ${size}x${size}"
convert -size ${size}x${size} xc:transparent canvas.png
time composite -resize ${size}x${size} $1 -gravity center canvas.png -size ${size}x${size} "${imagebasename}-${size}.png"
@dwilkins
dwilkins / btscript.sh
Created August 5, 2013 03:46
My Nintendo Wii pairing script. Won't work on Fedora 19 for some reason...
#!/bin/bash
on_die()
{
STATUS=`${DISCONNECT_COMMAND}`
exit 0
}
# Execute function on_die() receiving TERM signal
@dwilkins
dwilkins / expanded_output.md
Last active December 20, 2015 12:49
Expanded output for MySQL and Postgres

Without \x

Normal Postgres Output - off the right hand side of the page or wrapped and unreadable

db_development=# select * from users;
 id |        email         |                      encrypted_password                      | reset_password_token | reset_password_sent_at | remember_created_at | sign_in_count |     current_sign_in_at     |      last_sign_in_at       | current_sign_in_ip | last_sign_in_ip |         created_at         |         updated_at         | admin 
----+----------------------+--------------------------------------------------------------+----------------------+------------------------+---------------------+---------------+----------------------------+----------------------------+--------------------+-----------------+----------------------------+----------------------------+-------
 1 | [email protected] | $2a$10$hHZ4XhiTgXY62slgpsXd3u2Nd0pC3Ejl0IbsNZK1t2r5aPlxyl3QO | | | | 1 | 2013-08-01 16:23:4
@dwilkins
dwilkins / pi-muncher
Created June 6, 2013 15:18
pi-blaster ate my sd card (at least some of it)
[dwilkins@alarmpi source]$ ls -l
ls: cannot access pi-blaster: Input/output error
total 0
d????????? ? ? ? ? ? pi-blaster
[dwilkins@alarmpi source]$
@dwilkins
dwilkins / index.html.haml
Created April 28, 2013 16:03
Trouble using microevent.js with virtualjoystick.js
#crawler-js-container
#crawler-js
:coffeescript
window.joystick = {};
($ document).ready ->
MicroEvent.mixin VirtualJoystick
window.joystick = new VirtualJoystick({
container : document.getElementById('crawler-js-container'),
mouseSupport : true
})