Skip to content

Instantly share code, notes, and snippets.

group: H01
emp = {
id:number, salary:number
12345, 100
99999, 200
}
/*
Basic MQTT example
This sketch demonstrates the basic capabilities of the library.
It connects to an MQTT server then:
- publishes "hello world" to the topic "outTopic"
- subscribes to the topic "inTopic", printing out any messages
it receives. NB - it assumes the received payloads are strings not binary
It will reconnect to the server if the connection is lost using a blocking
void setup() {
// put your setup code here, to run once:
for (int i = 2; i < 11; i++) {
pinMode(i,OUTPUT);
digitalWrite(i, HIGH);
}
}
void loop() {
// put your main code here, to run repeatedly:
<source>
@type http
port 9880
</source>
<filter **>
@type stdout
</filter>
<match **>
@jbott
jbott / acc_to_angles.ino
Last active July 7, 2016 20:29
Set of scripts to do get angles from the 9dof sensor stick
#include <Wire.h>
#include <I2Cdev.h>
#include <ADXL345.h>
ADXL345 acc;
void setup() {
Serial.begin(9600);
Wire.begin();
acc.initialize();
@jbott
jbott / docker-container@.service
Last active February 9, 2016 19:25
A docker container systemd service file. This has no support for container dependencies.
[Unit]
Description=Docker %i container
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a %I
ExecStop=/usr/bin/docker stop -t 2 %I
@jbott
jbott / proxy.sh
Created May 29, 2013 17:54
Automatically create a ssh socks proxy and turn it on in network settings
#!/bin/sh
#######################################
#Remote settings
USER=USERNAME
HOST=HOSTNAME
PORT=22
#Local settings
INAME=Wi-Fi
LPORT=8080
@jbott
jbott / sklearn_iris_tensorflow.py
Created November 12, 2015 15:35
Scikit-learn iris data set classification using TensorFlow
import sklearn
import tensorflow as tf
from sklearn import datasets
iris = datasets.load_iris()
# Convert targets to one hot
targets_onehot = [0] * len(iris.target)
for i,target in enumerate(iris.target):
targets_onehot[i] = [0] * 3
#!/bin/bash
#
# How this works:
# Curl -> Grabs the organization repos from the github api
# grep -> Filter to only clone_url's
# grep -> Select the url from that line
# xargs -> For each line, run git clone [line]
curl -s "https://api.github.com/orgs/${1}/repos?per_page=200" | grep clone_url | grep -oh "https.*git" | xargs -L1 git clone