Skip to content

Instantly share code, notes, and snippets.

View DustinAlandzes's full-sized avatar

Dustin Alandzes DustinAlandzes

View GitHub Profile
@DustinAlandzes
DustinAlandzes / webcam-cv2.py
Created February 21, 2017 03:19 — forked from tedmiston/webcam-cv2.py
Display the webcam in Python using OpenCV (cv2)
'''
Simply display the contents of the webcam with optional mirroring using OpenCV
via the new Pythonic cv2 interface. Press <esc> to quit.
'''
import cv2
def show_webcam(mirror=False):
cam = cv2.VideoCapture(0)
while True:
#!/usr/bin/env python
"""
Found on
http://www.steinm.com/blog/motion-detection-webcam-python-opencv-differential-images/
"""
import cv2
def diffImg(t0, t1, t2):
# sudo apt-get install python-opencv
# opencv only works in python2?
import cv2.cv as cv
from datetime import datetime
import time
class MotionDetector():
def onChange(self, val): #callback when the user change the ceil
self.ceil = val
ping -c4 google.com > /dev/null
if [ $? != 0 ]
then
echo "No network connection, restarting wlan0"
/sbin/ifdown 'wlan0'
sleep 10s
/sbin/ifup --force 'wlan0'
fi
# Created by Hosted Graphite on 2017-03-14 20:58:35 UTC
# https://wwww.hostedgraphite.com/app/data-sources/
# Created for collectd version 5.4
# Config file for collectd(1).
#
# Some plugins need additional configuration and are disabled by default.
# Please read collectd.conf(5) for details.
#
# You should also read /usr/share/doc/collectd-core/README.Debian.plugins
# before enabling any more plugins.
@DustinAlandzes
DustinAlandzes / telegraf.conf
Created March 29, 2017 20:09
/etc/supervisor/conf.d/telegraf.conf
[program:telegraf]
command=/usr/bin/telegraf
autostart=true
autorestart=true
stderr_logfile=/var/log/telegraf.err.log
stdout_logfile=/var/log/telegraf.out.log
#!/bin/bash
#download telegraf, decompress, merge with root
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.2.1_linux_armhf.tar.gz
tar xvfz telegraf-1.2.1_linux_armhf.tar.gz
rsync -av telegraf/* /
#install supervisord, add telegraf.conf from another gist, reread, update
apt-get install supervisor
wget https://gist.githubusercontent.com/f00-/969f73db5e0bff8202d61c8df2fb8475/raw/b373ec187fec469e17d2d448ac603e4d6a7e5494/telegraf.conf
from flask import Flask, render_template
import json, requests
app = Flask(__name__)
@app.route("/")
def tickets():
base_url = "www.milb.com"
path = "/ticketing-client/json/EventTicketPromotionPrice.tiksrv"
parameters = "?team_id=498&display_in=singlegame&end_date=20170705&event_type=O&home_team_id=498&site_section=Default&begin_date=20170605&venue_id=2682&year=2017&leave_empty_games=true&ticket_category=Tickets"
#/bin/sh
DISPLAY=:0
#minimzie everything
wmctrl -k on
#ncompass window id
winid=`wmctrl -l | grep nCompass | cut -d " " -f1`
#teamviewer window id
teamviewer=`wmctrl -l | grep TeamViewer | cut -d " " -f1`
avconv -same_quant -i "input.wmv" "output.mkv"