Skip to content

Instantly share code, notes, and snippets.

import os
import gi
try:
gi.require_version('Gst', '1.0')
except ValueError:
print 'Could not find required Gstreamer library'
sys.exit(1)
from gi.repository import GObject, Gst
os.environ["GST_DEBUG"] = "4"
@superlou
superlou / game_server.rb
Created March 15, 2014 13:03
Game Logic
require 'artemis'
require './components.rb'
class GameServer
def run
puts "Starting server..."
@world = Artemis::World.new
@world.add_manager Artemis::TagManager.new
@world.set_system(RouteMovementSystem.new).setup
@superlou
superlou / Sparse Data
Created April 22, 2014 13:41
Example Data
timestamp1, data1, timestamp2, data2
1, 324, 1.2, 102
2, 231, 2.3, 429
3, 432, 3.1, 300
@superlou
superlou / edit.es6
Last active August 29, 2015 14:00
Library Update
export default Ember.ObjectController.extend({
actions: {
save: function() {
var _this = this;
console.log(this.get('content'));
this.get('content').save().then(
function(val) {
_this.transitionToRoute('books.book', _this.get('content'));
},
function(err) {}
@superlou
superlou / Error Message
Last active August 29, 2015 14:00
undefined method `checkout_url' on line 21. Works if I change checkouts_controller.rb line 21 to `respond_with checkout, location: api_v1_checkout_path(checkout)`.
<header>
<h1>
NoMethodError
in Api::V1::CheckoutsController#create
</h1>
</header>
<div id="container">
<h2>undefined method `checkout_url&#39; for #&lt;Api::V1::CheckoutsController:0x00000005ec52c0&gt;</h2>
@superlou
superlou / checkout.es6
Created April 29, 2014 23:56
Computed properties for ember data
var attr = DS.attr;
var belongsTo = DS.belongsTo;
App.Checkout = DS.Model.extend({
book: belongsTo('book'),
patron: belongsTo('patron'),
status: attr(),
closed_at: attr('date'),
created_at: attr('date'),
@superlou
superlou / intervideotest2.c
Last active August 29, 2015 14:02
intervideosrc swapping channels test
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <stdlib.h>
#include <glib/gprintf.h> // Needed because of bug in glib includes?
#include <string.h>
@superlou
superlou / Makefile.am
Created June 30, 2014 00:36
Intervideosrc test
include $(top_srcdir)/common/check.mak
CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.reg
TEST_FILES_DIRECTORY = $(top_srcdir)/tests/files
GST_TOOLS_DIR = $(top_builddir)/tools
REGISTRY_ENVIRONMENT = \
GST_REGISTRY_1_0=$(CHECK_REGISTRY)
@superlou
superlou / cost_rollup.py
Created July 21, 2014 00:58
Generate a summary of all parts and their costs given a prices.csv file and mfpns assigned on components
import numpy as np
import pandas
import xml.etree.ElementTree as ET
def get_component_field(comp_el, field_name, default=None):
field_el = comp_el.find("./fields/field[@name='{0}']".format(field_name))
if field_el is not None:
return field_el.text
else:
@superlou
superlou / intervideosrc.c
Created August 6, 2014 01:08
Trying to write intervideosrc/sink test
/* GStreamer
*
* unit test for intervideosrc
*
* Copyright (C) <2014> Louis Simons <lousimons at gmail dot com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.