Skip to content

Instantly share code, notes, and snippets.

@donpdonp
donpdonp / kluster.js
Last active September 17, 2019 00:57
gluon kmeans cluster test
(function() {
return {
name: "kluster"
}
})
var proxpairs = {}
function go(msg) {
if(msg.method == "irc.privmsg") {
diff --git a/src/main.zig b/src/main.zig
index d651eb9..93bb0ea 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -230,7 +230,7 @@ fn netback(command: *thread.Command) void {
for(tree.root.Array.toSlice()) |jsonValue| {
const item = jsonValue.Object;
var toot = allocator.create(toot_lib.Type) catch unreachable;
- toot.init(item, allocator);
+ toot = toot_lib.Type.init(item, allocator);
/* gdk/gdkevents.h */
struct _GdkEventTouch
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
guint32 time;
gdouble x;
gdouble y;
gdouble *axes;
/* https://github.com/cirosantilli/x86-bare-metal-examples#bios-hello-world */
#include "common.h"
BEGIN
DBG
mov $msg, %si
mov $0x0e, %ah
loop:
lodsb
or %al, %al
@donpdonp
donpdonp / 911.js
Last active March 11, 2020 16:25
gluon Portland 911 watch
(function() {
return {name:"911"}
})
var alert_channel = '#pdxbots'
var reports
var reportdate
function go(msg) {
if (msg.method == "clocktower" && (new Date(Date.parse(msg.params.time))).getMinutes() == 15) {
(function() {
return {name: "russelltemp"}
})
function go(msg){
if (msg.method == "irc.privmsg") {
var epoch_match = /^!russelltemp(\s+(\S+))$/.exec(msg.params.message)
if(epoch_match) {
var sensor_id = epoch_match[2]
var rows = russelltemp(sensor_id)
@donpdonp
donpdonp / osm.js
Last active March 22, 2022 17:56
gluon osm openstreetmap lookups
(function() {
// descriptor
return {name:"osm"}
})
// osm json
//{"bearing":345.9410965462545,"distance":355.0966239302687,
// "node":{"id":1963188104,"lat":45.5233261,"lon":-122.6584695,"tags":{...
function go(msg) {
@donpdonp
donpdonp / shift2bikes.js
Last active June 4, 2019 19:56
gluon shift2bikes pedalpalooza calendar
(function() {
return {name:"shift2bikes"}
})
function go(msg) {
if (msg.method == "irc.privmsg") {
var cmd = /^!shift2bikes(\s+(.*))?/.exec(msg.params.message)
if(cmd) {
var now = new Date()
var rides = shiftGet(now)
donp@jewel zig $ git diff
diff --git a/build.zig b/build.zig
index dd8c6fe..3411e9d 100644
--- a/build.zig
+++ b/build.zig
@@ -1,3 +1,4 @@
+const builtin = @import("builtin");
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
@donpdonp
donpdonp / omdb.js
Last active September 18, 2019 01:47
gluon omdb/imdb
(function() {
// setup
setup()
// descriptor
return {name:"omdb"}
})
var api_key
function setup() {