Skip to content

Instantly share code, notes, and snippets.

View tdg5's full-sized avatar

Danny Guinther tdg5

View GitHub Profile
@tdg5
tdg5 / lsmod
Created June 5, 2014 13:16
lsmod from my Surface Pro on Ubuntu 14.04
Module Size Used by
btusb 32412 0
snd_hda_codec_hdmi 46207 1
snd_hda_codec_realtek 61438 1
hid_sensor_accel_3d 13221 0
hid_sensor_als 13123 0
hid_sensor_magn_3d 13209 0
hid_sensor_gyro_3d 13209 0
hid_sensor_trigger 12916 4 hid_sensor_gyro_3d,hid_sensor_accel_3d,hid_sensor_als,hid_sensor_magn_3d
joydev 17381 0
@tdg5
tdg5 / acpi_wakeup
Created June 5, 2014 13:13
init.d script to manage acpi wakeup devices for Surface Pro
#! /bin/sh
### BEGIN INIT INFO
# Provides: acpi_wakeup
# Required-Start: $remote_fs $syslog $all
# Required-Stop: 0 6
# Default-Start: 1 2 3 4 5
# Default-Stop:
# Short-Description: Disable acpi wakeup for given devices
### END INIT INFO
// Requires angular-mock
describe('$templateCache service', function() {
var service,
httpBackend,
template = "<div>test</div>",
templateResponse = '<script id="test" type="text/ng-template">' + template + '</script>';
@tdg5
tdg5 / the_cats_meow.rb
Last active August 29, 2015 13:55
Mildly insane examples of overriding the reader method of the ActiveSupport provided :class_attribute directly and as part of an ActiveSupport::Concern.
class Feline
class_attribute :meow
self.meow = '<feline-silence/>'
def self.meow
raise NotImplementedError
end
end
class MetaCat < Feline
@tdg5
tdg5 / fingerprintedTemplates.js
Created January 21, 2014 11:37
An ERB precompiled AngularJS service for Rails allowing easy access to HTML templates fingerprinted by the Asset Pipeline.
<%
# Generate lookup Hash of fingerprinted filenames for html templates
# Leave regexp open ended to include preprocessed templates (.erb, etc.)
template_regexp = /(?:\/assets\/templates\/)(.*\.html)/
template_files = Rails.application.assets.each_file.to_a.join("\n").scan(template_regexp).flatten
templates = Hash[template_files.map {|file| [file, asset_url(file)] }]
%>
var fingerprintedTemplates = angular.module('services.fingerprintedTemplates', []);
fingerprintedTemplates.factory('fingerprintedTemplates', [
@tdg5
tdg5 / gist:7891302
Created December 10, 2013 14:21
beanstalkd peek-oldest command
diff --git a/dat.h b/dat.h
index 2570e76..ac6f6e7 100644
--- a/dat.h
+++ b/dat.h
@@ -204,6 +204,9 @@ void job_free(job j);
/* Lookup a job by job ID */
job job_find(uint64 job_id);
+/* Lookup oldest job */
+job job_oldest();