Skip to content

Instantly share code, notes, and snippets.

View bennettgoble's full-sized avatar
😽

Signal Linden bennettgoble

😽
View GitHub Profile
using System;
using System.Runtime.Serialization;
using Grfid.NSurf.Enums;
using Newtonsoft.Json;
namespace Grfid.NSurf.Models
{
[Serializable]
public class OsrfMessage
{
using System;
using System.Runtime.Serialization;
using Grfid.NSurf.Enums;
using Newtonsoft.Json;
namespace Grfid.NSurf.Models
{
[Serializable]
public class OsrfMessage
{
@bennettgoble
bennettgoble / gist:2669265
Created May 12, 2012 21:44
OpenSRF Cross Origin Resource Sharing Support
diff --git a/src/gateway/apachetools.c b/src/gateway/apachetools.c
index ca41832..276bcb5 100644
--- a/src/gateway/apachetools.c
+++ b/src/gateway/apachetools.c
@@ -171,6 +171,47 @@ int apacheError( char* msg, ... ) {
}
+int crossOriginPreflight(request_rec* r, osrfStringArray* allowed_origins) {
+
Object.prototype.copyFrom = function(obj) {
for (var prop in obj) {
if (this.hasOwnProperty(prop))
this[prop] = obj[prop];
}
};
// TODO: generic prototypes for messages of same type (eg. STATUS)
// instead of having a serialization() method in every class
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using GRFID;
using AT570UHF_NET;
namespace AT570UHFReader
{
@bennettgoble
bennettgoble / request_hash.py
Created February 19, 2012 20:47
Request Hashing with Flask
from hashlib import sha1
from flask import Blueprint, request
bp = Blueprint('bp', __name__)
class HashedStream(object):
def __init__(self, stream):
@bennettgoble
bennettgoble / jquery.prompt.js
Created December 15, 2011 17:52
Updated jQuery prompt plugin from http://blog.zenoplex.jp/2009/08/09/adding-prompt-text-to-text-input-with-jquery/ modified to work with textareas. Requires jquery.color.js
(function (jQuery) {
jQuery.fn.extend({
prompt: function (option) {
var defaultText;
if ((typeof option) == "string") defaultText = option;
else if (option && option.text) defaultText = option.text;
else return;
var promptColor = (option && option.color) ? option.color : "#999999";
@bennettgoble
bennettgoble / UploadBot.py
Created December 3, 2011 20:38
A gross little IronPython script to upload textures to Second Life (tga, bmp, jpg.) Required libomv libs: log4net, openjpeg-dotnet, OpenMetaverse, OpenMetaverse.StructuredData, OpenMetaverseTypes, XMLRPC
import clr
import os
import sys
import time
clr.AddReference('System', 'System.Drawing', 'OpenMetaverse.dll', 'OpenMetaverseTypes.dll')
from System.Drawing import Bitmap
from System.Threading import AutoResetEvent
from OpenMetaverse import *
@bennettgoble
bennettgoble / jsoncpp-PKGBUILD.diff
Created November 6, 2011 00:54
Arch Linux AUR: jsoncpp PKGBUILD patch
20c20
< cp -r include/json ${pkgdir}/usr/include/json
---
> cp -r include/json ${pkgdir}/usr/include/jsoncpp
24c24
< ln -sf libjson_linux-gcc-*_libmt.so libjson.so
---
> ln -sf libjson_linux-gcc-*_libmt.so libjsoncpp.so
@bennettgoble
bennettgoble / remap_label_printer.bat
Created October 17, 2011 15:22
Remap Printer Port
@echo off
::----------------------------
:: variables
set host=COMPUTER-PC
set printer=LabelPrinter
:: printer_available result
set available=""
::----------------------------