Skip to content

Instantly share code, notes, and snippets.

@bgloh
bgloh / rasp-bluez.md
Last active June 4, 2019 17:16
how to use bluetooth on raspberry pi - bluez

TI Sensor Tag and Raspberry Pi In this tutorial, you will learn how to use Bluetooth to connect and get sensor readings from a TI CC2650 SensorTag to a Raspberry Pi by AllanMarube

1. Get the latest version of Bluez (the Bluetooth Stack for Linux).

One can use wget utility to download the latest tar ball as shown below, on the Raspberry Pi terminal:

wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.32.tar.xz

2.Use the following set of commands to perform the installation of the said libraries:

@bgloh
bgloh / golang_on_rpi.md
Created February 10, 2018 01:29 — forked from simoncos/golang_on_rpi.md
Install Golang 1.9 on Raspberry Pi

Install Golang 1.9:

wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin # put into ~/.profile

If already installed old golang with apt-get:

@bgloh
bgloh / MqttClientAsync.java
Created January 24, 2018 18:32
MQTT Async Client
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttAsyncClient;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
public class MqttClientAsync implements MqttCallback {
@bgloh
bgloh / MqttSubscribeSample.java
Created January 24, 2018 01:35 — forked from benedekh/MqttSubscribeSample.java
MQTT Asynchronous Subscriber Client Sample based on https://www.eclipse.org/paho/clients/java/
package mqtt.demo;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttAsyncClient;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
@bgloh
bgloh / SimpleMqttClient.java
Last active January 24, 2018 01:36 — forked from m2mIO-gister/SimpleMqttClient.java
Example MQTT Messaging in Java
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.MqttTopic;
public class SimpleMqttClient implements MqttCallback {
@bgloh
bgloh / AngularJS_D3_FireBase
Created July 17, 2017 06:22
AngularJS_D3_FireBase
<!DOCTYPE html>
<html>
<head>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.1.3/firebase.js"></script>
<<link rel="stylesheet" type="text/css" href="./todo.css">
</head>
<style>
body{
@bgloh
bgloh / AngularJS_D3_JS
Last active July 16, 2017 15:25
AngularJS + D3.js
<!DOCTYPE html>
<html>
<head>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
</head>
<style>
body{
margin: 0;
}
@bgloh
bgloh / Java_Handler_periodic_timer.java
Created July 7, 2017 05:42
Java periodic timer handler
package com.example.brian.myapplication_timer_handler;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends AppCompatActivity {
@bgloh
bgloh / MibandService.java
Created July 7, 2017 03:14
Mi band Service UUID
package me.flyingrub.mibandnotify.miband;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class MiBandService {
public static final String MAC_ADDRESS_FILTER = "88:0F:10";
@bgloh
bgloh / sensortag.py
Last active June 9, 2017 03:50
bluepy sensortag.py
from bluepy.btle import UUID, Peripheral, DefaultDelegate, AssignedNumbers
import struct
import math
def _TI_UUID(val):
return UUID("%08X-0451-4000-b000-000000000000" % (0xF0000000+val))
# Sensortag versions
AUTODETECT = "-"
SENSORTAG_V1 = "v1"