This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date,time,sys,dia,pulse | |
2019-02-09,15:17:44,129,86,69 | |
2019-02-09,08:48:58,120,84,63 | |
2019-02-08,19:29:04,116,78,71 | |
bp <- read.csv(file="/tmp/x.csv", header=TRUE, sep=",") | |
bp$date = as.Date(bp$date) | |
n = nrow(bp) | |
bq <- bp[order(bp$date, bp$time),] | |
matplot(bq, type="p", xaxt="n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# Predicts the label based on the sum of the observations with tolerance around 0 | |
# | |
# ('Training accuracy for prediction +1:', 0.64809384164222872) | |
# ('Training accuracy for prediction -1:', 0.37745098039215685) | |
# ('Training accuracy for prediction 0:', 0.3524945770065076) | |
# | |
# Grader Score: 44.29% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os.path | |
import numpy as np | |
import collections | |
import util | |
USAGE = "%s <test data folder> <spam folder> <ham folder>" | |
def get_counts(file_list): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
import numpy as np | |
# DO NOT MODIFY THIS FUNCTION | |
def convert_tree_as_set_to_adjacencies(tree): | |
""" | |
This snippet of code converts between two representations we use for | |
edges (namely, with Chow-Liu it suffices to just store edges as a set of | |
pairs (i, j) with i < j), whereas when we deal with learning tree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH=/usr/local/bin:$PATH | |
WEMO=wemo | |
HOST=iot | |
CLIENT=wemo_mqtt | |
STAT=stat/wemo/power | |
CMND=cmnd/wemo/power | |
. wemo_functions.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wemo_get() | |
{ | |
local host=$1 | |
cat << EOF | | |
<?xml version="1.0" encoding="utf-8"?> | |
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" | |
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> | |
<s:Body> | |
<u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MAX 5 | |
Semaphore forks[MAX]; | |
byte ids = 1; | |
byte leds[] = { 5, 6, 7, 8, 9 }; | |
void eating(byte id) { | |
digitalWrite(leds[id], HIGH); | |
Tasks::delay(1 + random(MAX * 100)); | |
digitalWrite(leds[id], LOW); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msp430fr5739$ /usr/local/energia/hardware/tools/msp430/bin/msp430-nm Blink.elf > Blink.out | |
msp430fr5739$ mspdebug -q rf2500 | |
Trying to open interface 1 on 056 | |
rf2500: warning: can't detach kernel driver: No data available | |
Device: MSP430FR5739 | |
fet: FET returned NAK | |
warning: device does not support power profiling | |
(mspdebug) sym import Blink.out | |
(mspdebug) setbreak setup | |
Set breakpoint 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Interrupted.h> | |
#define LED 0 | |
#define TIMER 1 | |
#define BUTTON 2 | |
Watchdog timer(TIMER, 1); | |
External button(BUTTON, LOW); | |
PinChangeGroup portb; | |
PinChange led(LED, portb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import string | |
# while lines are hashed as-is into a map where values are | |
# sets of indices. | |
def hash_whole(hashes, idx, s): | |
h = hash(s) | |
if not h in hashes: |
NewerOlder