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
<?php | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://www.adafruit.com/products/2885"); //https://www.adafruit.com/products/2817 | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$return = curl_exec($ch); | |
curl_close($ch); | |
$find = '<meta name="twitter:data2" content="'; | |
$find2 = '">'; | |
$outOfStock = "OUT OF STOCK"; |
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
<?php | |
$command = "find /sys/bus/w1/devices -name '28-*'"; | |
$path = exec($command); | |
$fullpath = $path . "/w1_slave"; | |
$filename1 = $fullpath; | |
$handle1 = fopen($filename1, "r") or die("Unable to open file!"); | |
$myString1 = fread($handle1,filesize($filename1)); | |
fclose($handle1); | |
$tempC1 = ((float) substr($myString1, strpos($myString1,"t=")+2))/1000; | |
$tempF1 = ($tempC1*(9.0 / 5.0)) + 32.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
#LAMP server and web apps setup for host [servername] | |
#Rob Byrd | |
#created January 29, 2014 for hosted VM on Rackspace using Ubuntu 14.04 as OS | |
#updated January 15, 2016 | |
# ************************ Pre LAMP setup ************************ | |
#IMPORTANT** search this file and replace "abc12a" with your server non-root username | |
# and replace "123.123.123.123" with your server IP address | |
#also change the email addresses to your own | |
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 | |
DISKAVAILABLE=$(df / | awk '{ a = $3 } END { print a }'); | |
DISKUSED=$(df / | awk '{ a = $2 } END { print a }'); | |
DISKTOTAL=$((DISKAVAILABLE+DISKUSED)); | |
DISKPERCENTUSED=$(df / | awk '{ a = $5 } END { print a }'); | |
MEMUSE=$(free -m | head -n 2 | tail -n 1 | awk {'print $3'}); | |
MEMTOTAL=$(free -m | head -n 2 | tail -n 1 | awk {'print $2'}); | |
SWAPUSE=$(free -m | head -n 3 | tail -n 1 | awk {'print $3'}); | |
SWAPTOTAL=$(free -m | head -n 3 | tail -n 1 | awk {'print $2'}); | |
# TODO - Execute curl command once per day via cron, cat file here |
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
var requestjson = require('request-json'); | |
var request = require('request'); | |
var PushBullet = require('pushbullet'); | |
var pusher = new PushBullet('PUSHBULLET_API_KEY'); | |
var cheerio = require('cheerio'); | |
var stores = [ | |
{name:"The Pi Hut",url:'http://thepihut.com/products/raspberry-pi-zero',in_stock:check_pihut_inventory | |
}, | |
{name:"Adafruit",url:'https://www.adafruit.com/products/2816',in_stock:check_adafruit_inventory |
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
<?php | |
$paths = array(); | |
$command = "find /sys/bus/w1/devices -name '28-*'"; | |
exec($command,$paths); | |
$fullpath1 = $paths[0] . "/w1_slave"; | |
$fullpath2 = $paths[1] . "/w1_slave"; | |
$filename1 = $fullpath1; | |
$filename2 = $fullpath2; | |
//----- get first one -----// | |
$handle1 = fopen($filename1, "r") or die("Unable to open file!"); |
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 | |
# GUI-related packages | |
#pkgs=" | |
#xserver-xorg-video-fbdev | |
#xserver-xorg xinit | |
#gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base | |
#gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa | |
#gstreamer1.0-libav | |
#epiphany-browser |
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 homeassistant.remote as remote | |
import time | |
import math | |
import sys | |
def updateState(previous,current): | |
settings = {"device_class": "cold", "friendly_name": "Is the AC Running"} | |
if previous.state != current.state and math.fabs(float(previous.state)-float(current.state)) > .2: #if the absolute value delta is between 0 and 0.2 then we don't want to update the state to prevent false positives | |
if previous.state > current.state: #air temp is falling | |
print(":: ",current.state,"AC is running") |
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
<?php | |
$command = "cat /sys/class/thermal/thermal_zone0/temp"; | |
$temp = exec($command); | |
$tempC1 = ((float) $temp)/1000; | |
$tempF1 = ($tempC1*(9.0 / 5.0)) + 32.0; | |
$str = '{"cpu_temperature_F":'.number_format($tempF1,2).',"cpu_temperature_C":'.number_format($tempC1,2).'}'; | |
echo $str; | |
?> |
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
#borrowed from https://www.hackster.io/hardikrathod/pir-motion-sensor-with-raspberry-pi-415c04 | |
#and https://raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/ | |
import RPi.GPIO as GPIO | |
import time | |
#import sys | |
#from influxdb import InfluxDBClient | |
import requests | |
import automationhat |
OlderNewer