Skip to content

Instantly share code, notes, and snippets.

View dgrnbrg's full-sized avatar

David Greenberg dgrnbrg

View GitHub Profile
#######
####### In your python env, make sure you've installed pyartnet (`pip install pyartnet`)
#######
####### To run, you do: `python3 artnet.py` or `python3 artnet.py 2`
####### The numeric argument is the index of the pixel's color channel that we're animating
#######
####### This does a chaser effect up & down a 288 pixel strand on each port.
#######
####### You can run with an environment variable to change the universe. I run 12 copies in 12 terminals,
####### because the python I wrote isn't fast enough to run single-threaded, but even an older multicore
@dgrnbrg
dgrnbrg / artnet.py
Last active April 21, 2023 22:22
e131/sacn/artnet test program
#######
####### In your python env, make sure you've installed pyartnet (`pip install pyartnet`)
#######
####### To run, you do: `python3 artnet.py` or `python3 artnet.py 2`
####### The numeric argument is the index of the pixel's color channel that we're animating
#######
import asyncio
import logging
from pyartnet import SacnNode, ArtNetNode
import sys
@dgrnbrg
dgrnbrg / appdaemon_irk.yaml
Last active November 30, 2023 13:09
Randomized key resolution for apple device tracking
tracker_test:
class: IrkTracker
module: irk_tracker
training_input_text: input_text.irk_tag
data_loc: tracker_logs/
rows_per_flush: 100
@dgrnbrg
dgrnbrg / let_prime.clj
Last active December 12, 2015 09:29
Let macro that attempts to add the name that the variable was declared with to the metadata
(defmacro let'
"This is a `let` macro that also includes metadata about
what name was used for each form if that form supports
metadata."
[bindings & body]
(let [bindings'
(mapcat
(fn [[name form]]
(let [tmp-name (gensym)
meta-form `(if (and
@dgrnbrg
dgrnbrg / home.clj
Created October 18, 2012 02:38
Enlive - Code
(ns presentation.views.home
(:require [net.cgrand.enlive-html :as html]))
(def template-file "templates/home/index.html")
;; We'd normally pull this from a data store, but for the sake of example...
(def learned-things
["to look both ways multiple times before crossing a nyc intersection"
"how to bargain with street vendors"
"about an amazing library called enlive"
[[:goal
:==
[:fresh [<lvar:d_13663>] :==]
[:mplus
[[:mplus
[[:fresh [<lvar:?r_13672>] :==]]
[[:fresh [<lvar:?r_13673>] :== [:goal :seen]]]]]
[[:mplus
[[:fresh [<lvar:?r_13675>] :==]]
[[:fresh [<lvar:?r_13676>] :== [:goal :seen]]]]]]
module counter12952(
clock,
reset,
x
);
input wire clock;
input wire reset;
//outputs
output reg [7:0] x;
;Define a module with 1 parameter (n)
;it's an up-counter
(defmodule counter [n]
[:outputs [x ((uintm n) 0)]]
(connect x (inc x)))
;Generate the verilog for the module
(println (module->verilog (counter 8)))
;Generate a testbest that verifies that it produces
/*
Copyright 2004, Martian Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@dgrnbrg
dgrnbrg / gist:2323127
Created April 6, 2012 21:36
guzheng lein
(ns leiningen.guzheng
(:use [leiningen.compile :only [eval-in-project]])
(:use guzheng.core))
(defn guzheng [project & nses]
(eval-in-project
project `(do
(clojure.test/run-tests 'guzheng.test.core))
'(require 'guzheng.core 'clojure.test)))
(comment(guzheng.core/run-test-instrumented