Skip to content

Instantly share code, notes, and snippets.

View Radiotechniman's full-sized avatar

Radiotechniman

View GitHub Profile
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
//Your timezone
date_default_timezone_set("Europe/Amsterdam") ;
//IP Address of Homey, make sure it has a fixed address
$homey_ip = "192.168.1.6" ;
@Radiotechniman
Radiotechniman / feestdagen.php
Last active December 5, 2020 10:45 — forked from tvlooy/feestdagen.php
Feestdagen berekenen
<?php
// (c) Tom Van Looy <tom@ctors.net> https://ctors.net/isc_license.txt
// Alle feestdagen kunnen berekend worden, de berekende zijn allemaal
// afhankelijk van pasen. PHP heeft een functie easter_date().
// Makkie dus. Hoe easter_date() zelf werkt kan je hier raadplegen:
// https://github.com/php/php-src/blob/master/ext/calendar/easter.c
// Geen parameter? Doen we gewoon dit jaar toch.
<?PHP
// https://twitter.com/#!/marcoarment/status/59089853433921537
date_default_timezone_set('America/Los_Angeles');
// Sosumi - a PHP client for Apple's Find My iPhone web service
//
// June 20, 2010
// Tyler Hall <tylerhall@gmail.com>
// http://github.com/tylerhall/sosumi/tree/master
//
@Radiotechniman
Radiotechniman / putiodl
Created June 15, 2018 19:04 — forked from Neal/putiodl
put.io cli downloader
#!/bin/bash
#
# putiodl - put.io cli downloader
#
# Copyright (C) 2013 Neal <neal@ineal.me>
#
# Dependencies: jq, curl, wget
#
# Make sure ~/.putiodl exists and contains your put.io OAuth token.
#
@Radiotechniman
Radiotechniman / putiodl
Created June 15, 2018 19:04 — forked from Neal/putiodl
put.io cli downloader
#!/bin/bash
#
# putiodl - put.io cli downloader
#
# Copyright (C) 2013 Neal <neal@ineal.me>
#
# Dependencies: jq, curl, wget
#
# Make sure ~/.putiodl exists and contains your put.io OAuth token.
#
@Radiotechniman
Radiotechniman / buien.php
Created March 23, 2018 14:17
Simple php script to be used with homey which allows it to do something when it rains or will rain
<?php
//set the mm of rain you consider it's raining
$rainthreshold_minutes = "0.1" ;
$rainthreshold_hours = "0.5" ;
// according to buienradar there are 5 levels of rain per hour (mm/h)
// 0-2
// 2-5
// 5-10
// 10-100
@Radiotechniman
Radiotechniman / port_scanner.php
Created March 8, 2018 15:47 — forked from akalongman/port_scanner.php
Port scanner on PHP
<?php
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
$host = 'google.com';
$ports = array(21, 25, 80, 81, 110, 143, 443, 587, 2525, 3306);
foreach ($ports as $port)
{
$connection = @fsockopen($host, $port, $errno, $errstr, 2);
@Radiotechniman
Radiotechniman / kliko.php
Last active March 8, 2018 15:41
Simple php script to be used with homey which allows it to do something on the days that the trash is collected and tell what type of trash is being collected
<?php
//since this is mainly geared toward the dutchies the return values are in dutch,
//you can however just update these to your own language
// make sure you cover the two below AND the ones in the "nice" function
$txt_today = "vandaag" ;
$txt_tomorrow = "morgen" ;
function nice($input){
@Radiotechniman
Radiotechniman / log.php
Last active February 16, 2018 08:19
Simple php page to serve as a log for homey without the need for the actual simplelog app
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$dir = 'logs';
date_default_timezone_set("Europe/Amsterdam");
//here you set the time format the current setup will show YYYYMMDD HH:MM:SS
//please see the php date() documentation to change
$current_time = date('Ymd H:i:s' );
@Radiotechniman
Radiotechniman / Philips Hue Candle Effect
Created December 4, 2016 18:32 — forked from jamesabruce/Philips Hue Candle Effect
High speed, flickering candle bulb effect for any number of Philips Hue bulbs
set HUB to "192.168.1.216" --change for your bridge IP
set USER to "newdeveloper"
repeat
repeat with bulb from 1 to 2 -- Change if you have more bulbs or want to use a subset
set hue to (random number from 5000 to 12750)
set sat to (random number from 150 to 255)
set bri to (random number from 50 to 255)
set transitiontime to (random number from 1 to 3) -- Increase range for slower transitions
set query to "{\"sat\":" & sat & ",\"hue\":" & hue & ",\"bri\":" & bri & ",\"transitiontime\":" & transitiontime & "}"
set command to "curl --request PUT --data '" & query & "' http://" & HUB & "/api/" & USER & "/lights/" & bulb & "/state/ --connect-timeout 5"