Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
'''
open-homeautomation/miflora
https://github.com/open-homeautomation/miflora
'''
from btlewrap import available_backends, BluepyBackend, GatttoolBackend, PygattBackend
# -*- coding:utf-8 -*-
import requests
DEV_ID = '' # MiFlora MAC
url = 'https://api.ohg.ag/iot/data/%s' % DEV_ID
sensor_data = [1970, 59, 26.2, 1376] # 光照, 水分, 溫度, 肥力
@a0726h77
a0726h77 / gist:f958138f0ecaa992f3d52df15a60fbc5
Last active October 19, 2016 09:57
bad_rice_tracking.py
#!/usr/bin/env python
# encoding: utf-8
import cv2
import numpy as np
READ_PICTURE = 1 # 0 => read from camera
PICTURE_PATH = "sample.jpg"
THRESHOLD = 180
@a0726h77
a0726h77 / list_pads.py
Last active December 18, 2015 03:05
List all pads of Hackpad
#!/usr/bin/env python
# encoding: utf-8
from hackpad_api import hackpad
from xmlrpclib import ServerProxy
from datetime import datetime
config = {'hackpad': {}, 'wikidot': {}}
config['hackpad']['subdomain'] = 'hackingthursday'
config['hackpad']['client_id'] = ''
#!/bin/bash
base='/home/yan/.irssi/irclogs/freenode/#h4'
inotifywait -m -r -e create -e modify -e close_write --exclude "\.git/*" $base | while read res
do
event=`echo $res | awk '{print $2'}`
file=`echo $res | awk '{print $3'}`
echo $res
# Qtile 0.8.0
# sysd widget sample
class Sysd(base.ThreadedPollText):
defaults = [
(
'api_url_root',
'http://127.0.0.1:8080/',
'API URL Root'
),