Skip to content

Instantly share code, notes, and snippets.

View bunsenmcdubbs's full-sized avatar

Andrew Dai bunsenmcdubbs

View GitHub Profile
@bunsenmcdubbs
bunsenmcdubbs / internet
Last active August 29, 2015 13:56
Forwarding network access through a usb tether to the Beaglebone Black. Adapted from http://robotic-controls.com/learn/beaglebone/beaglebone-internet-over-usb-only
#!/bin/bash
# run this on the computer first
ifconfig eth1 192.168.7.1
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
@bunsenmcdubbs
bunsenmcdubbs / MPU6050 I2C Fun on BeagleBone
Created January 6, 2014 04:44
MPU6050 I2C Fun on BeagleBone
root@beaglebone:~# i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
@bunsenmcdubbs
bunsenmcdubbs / xaccel.py
Created January 6, 2014 04:51
Short MPU6050 Test code in python, example for website full code in my BeagleCar Repo https://github.com/BunsenMcDubbs/BeagleCar/blob/master/src/test/xaccel.py
from Adafruit_I2C import Adafruit_I2C
from time import sleep
# initialize i2c connection to MPU6050
# i2c address is 0x68
i2c = Adafruit_I2C(0x68)
# wake up the device (out of sleep mode)
# bit 6 on register 0x6B set to 0
i2c.write8(0x6B, 0)
@bunsenmcdubbs
bunsenmcdubbs / attendee_order.md
Last active April 8, 2016 21:16
HackGT EventBriter Design Docs

Attendee Create Order

  1. Attendee navigates to event page
  2. TODO System checks for and removed expired ticket reservations
  3. System shows event view with available tickets
  4. Attendee selects ticket(s) from page
  5. System warns/prevents selecting unavailable tickets
  6. Attendee starts checkout process
  7. TODO System marks selected tickets as reserved
  8. System shows ticket information screen (collect attendee info)
type UserID int64
func export(customerID string) map[UserID]UserID {
graph := fetchGraph(customerID)
for src, _ := range graph {
find(graph, src) // Since this function mutates the graph, we don't need to store the results separately
}
return graph
}
@bunsenmcdubbs
bunsenmcdubbs / install-hbase-standalone.md
Last active February 19, 2021 22:34
Installing HBase v2.3.4 Standalone
@bunsenmcdubbs
bunsenmcdubbs / easy_postgres_docker.md
Last active April 20, 2021 20:57
Easiest way to spin up a dev/throwaway Postgres instance (Docker)

Introduction

This quick guide will spin up a Postgres 12 container accessible from localhost:9432. This is NOT a durable setup and data is very likely to be lost after the database is shutdown. For demo purposes only.

Prerequisites

  • Docker

Instructions

In one shell, run

$ docker run -e POSTGRES_PASSWORD=postgres --publish 9432:5432 --name demo-pg12 postgres:12

Keybase proof

I hereby claim:

  • I am bunsenmcdubbs on github.
  • I am bunsenmcdubbs (https://keybase.io/bunsenmcdubbs) on keybase.
  • I have a public key ASBuF5mjsIcs5BgT00dQ9in8WR5Ip2z4EZq_tDBGjNGpRwo

To claim this, I am signing this object:

@bunsenmcdubbs
bunsenmcdubbs / pubsub.go
Created July 6, 2022 22:12
Simple channel-less pub/sub pattern for go which avoids using channels in the public API
package main
import (
"fmt"
"sync"
)
type Subscriber struct {
callback func()
}