Skip to content

Instantly share code, notes, and snippets.

View vitiral's full-sized avatar

Rett Berg vitiral

  • Google
  • Denver, CO
View GitHub Profile
@vitiral
vitiral / README.md
Last active September 30, 2022 10:03
ZMQ python communications

ZMQ python

Demonstrates some simple zmq communication

Similar to this example but usable more generally.

Quoting http://zeromq.org/area:faq:

Can I subscribe to messages using regex or wildcards?

@vitiral
vitiral / asyncio_question
Created April 25, 2015 17:20
asyncio stack overflow question
import sys
import time
import socket
import asyncio
addr = ('127.0.0.1', 1064)
@asyncio.coroutine
@vitiral
vitiral / ip route
Last active February 20, 2018 21:21
nixos help
[root@garrett-laptop:~]# ip addr
...
5: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1406 qdisc pfifo_fast state UNKNOWN group default qlen 500
link/none
inet 10.249.208.187/32 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::a4be:e60c:f593:2fac/64 scope link stable-privacy
valid_lft forever preferred_lft forever
[root@garrett-laptop:~]# ip route
@vitiral
vitiral / .md
Created January 16, 2018 02:44
Heading anchors

This is my heading

(#my-heading)

some other heading

See my heading

@vitiral
vitiral / Arduino_extra_libs.patch
Created August 15, 2014 18:04
patch for Arduino-Makefile
From b5b44812c8928de1e7d1e3e2e1a31239b26f49b3 Mon Sep 17 00:00:00 2001
From: Garrett Berg <gberg@neutral.io>
Date: Fri, 15 Aug 2014 11:55:20 -0600
Subject: [PATCH] Arduino.mk
---
Arduino.mk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Arduino.mk b/Arduino.mk
// Expose the things we want to access.
// Threads always need to be exposed if you want to schedule them
// Note: the order is important!
expose_threads(TH_T(blinky_thread), TH_T(blinky_thread)); // wrap threads in TH_T
expose_functions(UI_F(reinit)); // Wrap functions in UI_F
UI_V(v1, sub_time); // Variables have to be declared specially. Declare variable names first with UI_V
//UI_V(v2, othervar) -- if you had more variables, continue in this way
expose_variables(UI_VA(v1)); // Then wrap the variable names in UI_VA. Alot of things have to be done to take up
@vitiral
vitiral / ui_led_example5--p3.cpp
Created April 6, 2014 23:01
ui_led_example5--p3.cpp
// This function can be called form the command line as "reinit"
// It resets all the settings.
uint8_t reinit(pthread *pt){
thread *th;
// First we try to kill the threads.
// Note: TRY simply silences any error outputs. You still have to clear errors
// afterwards (if you don't clear errors, it can effect the next funciton call)
// Note: this also destroys all thread data.
TRY(set_thread_innactive(get_thread(LED1)));
clrerr();
@vitiral
vitiral / ui_led_example5--p2.cpp
Last active January 15, 2016 10:54
ui_led_example5--p2
enum MYTHREADS{
LED1,
LED2
};
enum MYFUNCS{
REINIT
};
enum MYVARS{
@vitiral
vitiral / ui_led_example4--p1.cpp
Last active January 15, 2016 10:53
usertools ui_led_example4 explained -- part1
#include <ui.h> // include protothread library
#define LEDPIN 13 // LEDPIN is a constant
uint16_t sub_time = 0; // subtracts time from LED periods
void toggleLED() {
boolean ledstate = digitalRead(LEDPIN); // get LED state
ledstate ^= 1; // toggle LED state using xor
digitalWrite(LEDPIN, ledstate); // write inversed state back
@vitiral
vitiral / __init__.py
Last active August 29, 2015 14:15
Functions that should be standard to pandas dataframe objects
We couldn’t find that file to show.