Skip to content

Instantly share code, notes, and snippets.

View moonhouse's full-sized avatar

David Hall moonhouse

View GitHub Profile
@moonhouse
moonhouse / tv12.svg
Created February 20, 2014 17:43
TV12 logo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@moonhouse
moonhouse / find_large_rss_items.rb
Created March 4, 2014 16:23
Find RSS items (such as in Wordpress WXR) larger than 1 MB
files = Dir.glob('exports/*.xml')
files.each do |file|
puts file
no_of_items = 0
item_size = 0
File.open(file, "r").each_line do |line|
if line.include? '<item>'
no_of_items += 1
item_size = line.size
elsif line.include? '</item>'
@moonhouse
moonhouse / extract_item.rb
Created March 4, 2014 16:51
Extract one item from RSS file
file_name = ARGV[0]
item_no = ARGV[1].to_i
no_of_items = 0
correct_line = false
in_item = false
File.open(file_name, "r").each_line do |line|
if line.include? '<item>'
in_item = true
no_of_items += 1
@moonhouse
moonhouse / bjorn-stenberg-osm.html
Last active August 29, 2015 13:58
Video och bilder från Björn Stenbergs presentation av Open Street Map
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>OpenStreetMap - Björn Stenberg</title>
<script src="http://popcornjs.org/code/dist/popcorn-complete.min.js" type="text/javascript">
</script>
<script src="popcorn.slideshare.js" type="text/javascript">
</script>
@moonhouse
moonhouse / search_id.js
Created July 16, 2014 14:51
List objects with a certain id in MongoDB regardless of collection
var searchId = function (objId) {
coll = db.getCollectionNames();
coll.forEach(function(collName) {
obj = db[collName].findOne({'_id': ObjectId(objId)});
if (obj !== null) {
print(collName + " " + objId);
}
});
};

Keybase proof

I hereby claim:

  • I am moonhouse on github.
  • I am moonhouse (https://keybase.io/moonhouse) on keybase.
  • I have a public key whose fingerprint is 382B EC05 847B ADC8 D860 DDFE 65F9 8045 285A 7A5F

To claim this, I am signing this object:

@moonhouse
moonhouse / cmu-sphinxtrain.txt
Created May 2, 2015 18:25
brew install --HEAD watsonbox/cmu-sphinx/cmu-sphinxtrain
➜ ~ brew tap watsonbox/cmu-sphinx
==> Tapping watsonbox/cmu-sphinx
Cloning into '/usr/local/Library/Taps/watsonbox/homebrew-cmu-sphinx'...
remote: Counting objects: 41, done.
remote: Total 41 (delta 0), reused 0 (delta 0), pack-reused 41
Unpacking objects: 100% (41/41), done.
Checking connectivity... done.
Warning: Could not create link for watsonbox/cmu-sphinx/cmu-pocketsphinx, as it
conflicts with Homebrew/homebrew/cmu-pocketsphinx. You will need to use the
fully-qualified name when referring this formula, e.g.
@moonhouse
moonhouse / config.log
Last active August 29, 2015 14:20
SphinxTrain configure 5prealpha, which was generated by GNU Autoconf 2.69.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by SphinxTrain configure 5prealpha, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
@moonhouse
moonhouse / rc.local
Created May 27, 2015 15:35
Next, add this to /etc/rc.local; it waits for a monitor to be attached to the HDMI socket, probes it for its preferred mode, sets that preferred mode and finally resets the framebuffer ready for X to takeover:
# Wait for the TV-screen to be turned on...
while ! $( tvservice --dumpedid /tmp/edid | fgrep -qv 'Nothing written!' ); do
bHadToWaitForScreen=true;
printf "===> Screen is not connected, off or in an unknown mode, waiting for it to become available...\n"
sleep 10;
done;
printf "===> Screen is on, extracting preferred mode...\n"
_DEPTH=32;
eval $( edidparser /tmp/edid | fgrep 'preferred mode' | tail -1 | sed -Ene 's/^.+(DMT|CEA) \(([0-9]+)\) ([0-9]+)x([0-9]+)[pi]? @.+/_GROUP=\1;_MODE=\2;_XRES=\3;_YRES=\4;/p' );
@moonhouse
moonhouse / rc.local-2
Created May 27, 2015 15:36
With that all done, the installation needs to be told to start-up X using a tailored xinitrc (kept on the boot-partition so that it can easily be edited on a non-Linux machine) by adding the following to /etc/rc.local:
if [ -f /boot/xinitrc ]; then
ln -fs /boot/xinitrc /home/pi/.xinitrc;
su - pi -c 'startx' &
fi