Skip to content

Instantly share code, notes, and snippets.

View MicahStevens's full-sized avatar

Micah Stevens MicahStevens

View GitHub Profile
@MicahStevens
MicahStevens / gpio2command.py
Last active July 14, 2017 19:47
One way to issue a system command when someone pushes a button connected to the gpio
"""
Some references:
https://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/
https://stackoverflow.com/questions/89228/calling-an-external-command-in-python
"""
import RPi.GPIO as GPIO
import signal
import time
@MicahStevens
MicahStevens / Rpi_Configuration_Notes.md
Last active June 10, 2017 22:20
Raspberry Pi notes

Wireless mouse slow

Edit /boot/cmdline.txt and add usbhid.mousepoll=0 to the end.

starting an xwindows program from the command line to display on the touch screen

> sudo DISPLAY=:0 xinit /usr/bin/chromium-browser --incognito --no-sandbox --kiosk http://localhost/ 

kiosk mode chromium (see above)

@MicahStevens
MicahStevens / bin2Due.sh
Created April 25, 2016 20:58
Arduino Due bossac upload script
#!/bin/bash
DEFAULTPORT=ttyACM0
PORT=${2:-$DEFAULTPORT}
#reset port
/usr/bin/stty -F /dev/$PORT 1200
/usr/bin/stty -F /dev/$PORT 115200
# upload and verify
/usr/bin/bossac -i --port=$PORT -U false -e -w -v -b $1 -R
# -*- coding: utf-8 -*-
from __future__ import division
"""
Some functions for converting to and from two's compliment.
Useful for dealing with DSP functions in microcontrollers that you may want to
control with floating point coefficients and variables, but the processor stores everything
as int's..
All conversions assume you are dealing with 16 bit integer storage.
@MicahStevens
MicahStevens / processctl.sh
Created July 13, 2015 18:41
Generic start/stop script with support for virtualenvs
#!/bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
@MicahStevens
MicahStevens / webcam.html
Created October 31, 2014 19:54
An html file setup to control a Foscam HD camera. Read more here:
<!DOCTYPE html>
<html>
<head>
<title>Webcam</title>
<style type="text/css">
body {
text-align:center;
background-color:#000000;
color: #fff;
}
@MicahStevens
MicahStevens / someform.php
Last active August 29, 2015 14:07
example php mail script (simple)
<?php
$sent = false;
if (isset($_POST['submit']))
{
$sent =mail('someToAddress@example.com', 'My Subject', $_POST['message']);
}
?>
<html>
### Keybase proof
I hereby claim:
* I am MicahStevens on github.
* I am micahstev (https://keybase.io/micahstev) on keybase.
* I have a public key whose fingerprint is D27A 1CB6 3C79 4BD8 39D0 F947 8AE0 CBF2 08C9 4B0A
To claim this, I am signing this object: