Skip to content

Instantly share code, notes, and snippets.

Avatar

tagroup

View GitHub Profile
@tagroup
tagroup / recordRequestsLazy.sh
Last active Jan 2, 2017
Setup script to view what http traffic is coming to an ip address / server.
View recordRequestsLazy.sh
#!/bin/bash
apt-get update && apt-get upgrade -y
apt-get install -y apache2 php5
echo '' > /etc/apache2/sites-available/000-default.conf
echo '<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory "/var/www/html">
AllowOverride All
</Directory>
@tagroup
tagroup / echoSerial.c
Last active Dec 17, 2015
Raspberry serial communication with Arduino serial connection: see full blog at http://thomasloughlin.com
View echoSerial.c
/*
Software serial multple serial test
Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.
The circuit:
* RX is digital pin 10 (connect to TX of other device)
* TX is digital pin 11 (connect to RX of other device)
@tagroup
tagroup / stepper.sh
Last active Dec 16, 2015
GPIO Stepper Motor Code for Raspberry Pi
View stepper.sh
#!/bin/bash
gpio mode 0 out && gpio mode 1 out && gpio mode 2 out && gpio mode 3 out
gpio write 0 0 && gpio write 1 0 && gpio write 2 0 && gpio write 3 0
while true
do gpio write 0 1 && gpio write 3 1
gpio write 3 0 && gpio write 1 1
gpio write 0 0 && gpio write 2 1
gpio write 1 0 && gpio write 3 1
gpio write 2 0
done
View line-counting-apache2-stoplight.sh
#!/bin/bash
##I had greater hopes and dreams at the start
export red="gpio write 0 0"
export yellow="gpio write 1 0"
export green="gpio write 2 0"
#CLAR MEANS CLEAR!! CLAR MEANS CLEAR!! DIVE! DIVE!
export clar_red="gpio write 0 1"
export clar_yellow="gpio write 1 1"
export clar_green="gpio write 2 1"
#
@tagroup
tagroup / index.php
Created Mar 10, 2013
Hack to test Multilevel openzwave Switches
View index.php
<?php
/////////////////////////
//
//For multilevel put 0-99 in as a status and click the light bulb
// more at http://thomasloughlin.com/new-open-zwaveraspbian-image-ready-for-download/
////////////////////////////
session_start();
define("ZWAVE_HOST", "localhost");
define("ZWAVE_PORT", 6004);
@tagroup
tagroup / RainWaterOutputLogger.pde
Created Jan 20, 2013
Arduino Sketch for data logging water flow to an SD card. Project at http://thomasloughlin.com/rain-water-collection/.
View RainWaterOutputLogger.pde
#include <SD.h>
/*
This script is a simple combination of two existing example files.
The goal is to measure water flow coming from a rain collection barrel
The project progress can be found at http://thomasloughlin.com/rain-water-collection/.
*/
/**********************************************************
This is example code for using the Adafruit liquid flow meters.
@tagroup
tagroup / tradeking_streaming_quotes.php
Created Nov 3, 2012
TradeKing PHP Streaming Quote API Example
View tradeking_streaming_quotes.php
<?php
/*
Very quick and dirty expansion on the TradeKing PHP example to allow you to handle and process streaming quotes
see more at http://thomasloughlin.com
enjoy at your own risk
*/
date_default_timezone_set('America/Chicago');
// Your keys/secrets for access
$consumer_key = 'uqM2342345234523452345234520NT';
@tagroup
tagroup / manage_remote
Created Jul 6, 2012
Script to open a reverse ssh tunnel if a specific file exists on a server with 'yes' in it
View manage_remote
#!/bin/bash
WGET="/usr/bin/wget"
$WGET -q --tries=10 --timeout=5 http://youralwaysonserver/openpi.php -O /tmp/openpi &> /dev/null
if grep -Fxq "yes" /tmp/openpi
then
ssh -gNnT -R *:55555:raspberrypi.local:80 piremoteuser@youralwaysonserver &
PID=$!
echo "Opened"
sleep 360s;
You can’t perform that action at this time.