Skip to content

Instantly share code, notes, and snippets.

Howdy Hackers.

Lets have a heart-to-heart.

I love Noisebridge.

I really do love Noisebridge.

To say that my motivations for moving 3,000 miles from Akron, Ohio to put down roots on the west coast did not include Noisebridge would be a lie.

Codius Sandbox Eventing

At some point, a sandboxed process will try to run a syscall that interacts with IO, such as:

open(const char* path, int mode)

Within our sandbox, the following events happen:

  1. The process calls libc's open call
  2. Libc translates this to system(SYS_open, path, mode) using the constants in /usr/include/asm/unistd_64.h
/home/tdfischer/Projects/ripple/codius/rust/codius-sandbox-core/src/lib.rs:22:9: 25:10 error: cannot infer an appropriate lifetime due to conflicting requirements
/home/tdfischer/Projects/ripple/codius/rust/codius-sandbox-core/src/lib.rs:22 |sbox,e| {
/home/tdfischer/Projects/ripple/codius/rust/codius-sandbox-core/src/lib.rs:23 let s: sbox_ptr = mem::transmute(sbox);
/home/tdfischer/Projects/ripple/codius/rust/codius-sandbox-core/src/lib.rs:24 event_cb (s, e);
/home/tdfischer/Projects/ripple/codius/rust/codius-sandbox-core/src/lib.rs:25 }
/home/tdfischer/Projects/ripple/codius/rust/codius-sandbox-core/src/lib.rs:21:25: 21:37 note: first, the lifetime cannot outlive the expression at 21:24...
/home/tdfischer/Projects/ripple/codius/rust/codius-sandbox-core/src/lib.rs:21 let sbox = Box::new(Sandbox::new(
^~~~~~~~~~~~
/home/tdfischer/Projects/ripple/codius/rust/codius-s
@tdfischer
tdfischer / login-notify
Created December 24, 2014 06:48
login-notify
#!/usr/bin/python
import smtplib
from email.mime.text import MIMEText
import os
import sys
from twilio.rest import TwilioRestClient
import imp
config = imp.load_source('login_notify.config', '/etc/sysconfig/login-notify')
@tdfischer
tdfischer / Graviton.cpp
Created November 8, 2014 06:04
Arduino Graviton
#include "Graviton.h"
GravitonFleck::GravitonFleck(const char* serviceName, const GravitonDriver* driver, const GravitonFleckMethod methods[]) :
m_service (serviceName),
m_driver (driver),
m_methods (methods)
{}
@tdfischer
tdfischer / browser.py
Created July 20, 2014 08:14
self browsing webbrowser
#!/usr/bin/env python
from PyQt4 import QtCore, QtWebKit, QtGui, QtDeclarative
import sys
import random
app = QtGui.QApplication(sys.argv)
view = QtDeclarative.QDeclarativeView(QtCore.QUrl("browser.qml"))
view.show()
#include <graviton/client/cloud.h>
#include <stdlib.h>
static void
cb_browse (GravitonCloud *cloud, GravitonServiceEvent event, GravitonServiceInterface *iface, gpointer user_data)
{
GError *error = NULL;
switch (event) {
case GRAVITON_SERVICE_NEW:
g_print ("Found a door. I'm opening it!\n");
int main (int argc, char** argv)
{
EntropyCollection *collection;
GList *resources, cur;
collection = entropy_client_get_default_collection ();
resources = entropy_collection_sparql ("SELECT ?a { ?a a entropy:Resource . ?a dc:title \"Anamanaguchi\" . ?a a nfo:Audio .?a nmm:streamingBitrate ?b . FILTER (?b < 128.0 )}");
cur = resources;
while (cur) {
@tdfischer
tdfischer / main.c
Created April 18, 2014 10:51
entropy-control
#include <glib.h>
#include <entropy/client.h>
#include <entropy/resource.h>
#include <stdio.h>
GMainLoop *loop = NULL;
void
cb_download_file (EntropyClient *client, gchar **argv)
{
// A pin has been written to and its value updated
void cb_write (BigEarSensorValue *sensor_value, GValue *value)
{
gchar *name;
gchar *contents;
g_object_get (sensor_value, "name", name);
contents = g_strdup_value_contents (value);
g_print ("Write to sensor's %s: %s\n", name, contents);
g_free (contents);