Skip to content

Instantly share code, notes, and snippets.

View geoffjay's full-sized avatar

Geoff Johnson geoffjay

  • Vancouver, BC, Canada
View GitHub Profile
@geoffjay
geoffjay / extension.vala
Created July 18, 2016 21:33
WebKit Javascript extension
[DBus (name = "org.opendcs.Dcs.Extension")]
public class Dcs.UI.Extension.DOM : GLib.Object {
private int count;
private WebKit.WebPage page;
private static const JSCore.StaticFunction[] class_functions = {{
"get", (JSCore.ObjectCallAsFunctionCallback) meas_get_cb, JSCore.PropertyAttribute.ReadOnly
},{
@geoffjay
geoffjay / create_config_xml.tcl
Created January 13, 2017 21:22
Tool to create XML configs for d_hydro
#
# Procedure : createConfigXML
# Arguments : -mdf <filename> Name of mdf file
# -ddb <filename> Name of ddb file: exactly one of -mdf or -ddb must be specified
# -out <filename> Name of xml file to be generated
# -sp Use single precision Delft3D-FLOW executable
# -wait "true"/"false" [optional] DelftOnline wait value
# Return value: "" : No error
# Any other string: Error message
# Result : Produces an XML-file (name specified by -out) that can be read by d_hydro.exe (Delft3D-FLOW version 6.xx)
const Obj = `
type Obj {
id: String!
type: String
namespace: String
objects: [Obj]
properties: [Property]
}
`
const Property = `
type Property {
key: String!
value: String
}
`
export default Property
const Plugin = `
type Plugin {
id: String!
type: String
objects: [Obj]
properties: [Property]
}
`
export default Plugin
import Obj from './object'
import Property from './property'
import Plugin from './plugin'
const Configuration = `
type Configuration {
id: String!,
properties: [Property]
plugins: [Plugin]
objects: [Obj]
import { makeExecutableSchema } from 'graphql-tools'
import Configuration from './configuration'
import resolvers from '../resolvers'
const Query = `
type Query {
configuration(id: String!): Configuration
configurations: [Configuration]
}
#!/bin/bash
sudo dnf -y install https://dl.folkswithhats.org/fedora/$(rpm -E %fedora)/RPMS/fedy-release.rpm
sudo dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf -y install fedy
cd /tmp
git clone https://github.com/coanda/dactl.plugin
git clone https://github.com/coanda/dactl-mcc.plugin
sudo cp -R dactl.plugin /usr/share/fedy/plugins/
sudo cp -R dactl-mcc.plugin /usr/share/fedy/plugins/
pub fn recv(&mut self) -> Result<Vec<Vec<u8>>, Box<Error>> {
let poller = self.poller.as_mut().unwrap();
let sock = poller.wait::<ZSock>(Some(self.timeout.as_millis() as u32));
let mut resp: Vec<Vec<u8>> = Vec::new();
match sock {
Some(mut sock) => {
let msg = ZMsg::recv::<ZSock>(&mut sock).unwrap();
sock.flush();
/**
* compile:
* gcc -g -o json-hashtable `pkg-config --cflags --libs json-glib-1.0` json-hashtable.c
*
* memcheck:
* G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck \
* --leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite \
* --leak-resolution=high --num-callers=20 \
* --suppressions=/usr/share/glib-2.0/valgrind/glib.supp \
* ./json-hashtable