The Z-Stick does bi-directional communication over a UART. The connection speed is 115200, '8N1'. There are "requests" and "responses". The client software can make requests to the Z-Stick, and it will send responses. But it seems the Z-Stick can make requests of the client software too. I have yet to figure out the requests the Z-Stick sends to the client software.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "strscan" | |
class Lexer | |
IDENTIFIER = /[_A-Za-z][_0-9A-Za-z]*\b/ | |
IGNORE = %r{ | |
(?: | |
[, \c\r\n\t]+ | | |
\#.*$ | |
)* | |
}x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
require 'openssl' | |
require 'puma/server' | |
require 'ds9' | |
class Server < DS9::Server | |
def initialize socket, app | |
@app = app | |
@read_streams = {} | |
@write_streams = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example of calculating least-squares linear regression fit in Ruby | |
# | |
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any | |
# means. | |
# | |
# In jurisdictions that recognize copyright laws, the author or authors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -KU | |
TIMES = 100000 | |
require 'rubygems' | |
gem 'addressable', '~>2.0' | |
gem 'faker', '~>0.3.1' | |
gem 'rbench', '~>0.2.3' | |
require 'addressable/uri' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cons = fn (a, b) -> fn x -> x.(a, b) end end | |
car = fn (p) -> p.(fn (q, _) -> q end) end | |
cdr = fn (p) -> p.(fn (_, q) -> q end) end | |
each = fn (list, func) -> | |
iter = fn (list, func, next) -> | |
(fn (a, nil) -> func.(a) | |
(a, b) -> func.(a); next.(b, func, next) | |
end).(car.(list), cdr.(list)) | |
end | |
iter.(list, func, iter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
<link type="text/css" rel="stylesheet" href="style.css"/> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<style> | |
.node circle { | |
cursor: pointer; | |
fill: #fff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark/ips" | |
require "graphql/language/lexer" | |
require "graphql/language/token" | |
require "graphql/language/block_string" | |
schema = DATA.read | |
Benchmark.ips { |x| | |
x.report("graphql") { GraphQL::Language::Lexer.tokenize(schema) } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Okasaki style Functional Red Black Tree | |
# https://www.cs.tufts.edu/comp/150FP/archive/chris-okasaki/redblack99.pdf | |
# | |
# leaves and root are black | |
# BST | |
# No red node has a red child | |
# Every path from the root to a leaf has the same number of black nodes | |
module RBTree | |
class Leaf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b5aeef5703dab7da9ebb47cc20e4c8b64f7f5866 Mon Sep 17 00:00:00 2001 | |
From: Aaron Patterson <aaron.patterson@gmail.com> | |
Date: Thu, 12 Mar 2020 10:25:48 -0700 | |
Subject: [PATCH] Fix possible XSS vector in JS escape helper | |
This commit escapes dollar signs and backticks to prevent JS XSS issues | |
when using the `j` or `javascript_escape` helper | |
CVE-2020-5267 | |
--- |