Skip to content

Instantly share code, notes, and snippets.

@hcooper
hcooper / frigate_0.10_notification.yaml
Last active May 18, 2022 00:28 — forked from hunterjm/frigate_0.10_notification.yaml
Frigate 0.10 Notifications
blueprint:
name: Frigate Notification (0.10.0)
description: |
## Frigate Mobile App Notification
This blueprint will send a notification to your device when a Frigate event for the selected camera is fired. The notification will initially include the thumbnail of the detection, but include an actionable notification allowing you to view the clip and snapshot.
With this blueprint, you may send the notification to multiple devices by leaving "Device" blank and instead use a [notification group][1].
### Software Version Requirements
@hcooper
hcooper / roku_plex.py
Created November 3, 2016 06:40
Remotely control roku & plex
#!/usr/bin/env python3
from plexapi.server import PlexServer
from roku import Roku
PLEX_SERVER = 'http://plexserver:32400'
PLEX_TOKEN = '#############'
PLEX_CLIENT = 'Roku 3 - 4E755U058982'
ROKU_HOSTNAME = 'roku'
ROKU_PLEX_APP = 'Plex'
#!/bin/vbash
# If IPv6 is working - exit.
/bin/ping6 -c 2 -n google.com > /dev/null
if [ $? == 0 ]; then
echo "IPv6 working."
exit 0;
fi
# If we have no working IPv4 connection - exit.
@hcooper
hcooper / whereizip
Created November 3, 2015 07:43
icanhazip.com style geolocation
curl -s http://ip-api.com/csv | cut -d , -f 3
@hcooper
hcooper / fix-vidstab-kdenlive
Created December 19, 2014 16:22
fix video stabilization in kdenlive
--- /tmp/kdenlive-0.9.10/src/project/projectlist.cpp 2014-10-05 10:55:35.000000000 +0100
+++ src/project/projectlist.cpp 2014-12-19 16:05:33.906585717 +0000
@@ -3648,9 +3648,10 @@
// producer params
preParams << jobParams.takeFirst();
// filter name
- preParams << jobParams.takeFirst();
+ QString filterName = jobParams.takeFirst();
+ preParams << filterName;
// filter params

Running Koken on HHVM

There's only three steps required to make Koken 0.15.0 work on HHVM:

  1. Koken's plugin support depends on the output of get_declared_classes() matching the order the that classes were defined - which can't be guaranteed. The best solution for this would be to ensure plugins were named the same as their classes, but until they do, this patch parses the plugin for the class name: https://gist.github.com/hcooper/a978a1328da787deb390

  2. In i.php Koken hard-codes a Content-Length header, which causes requests to hang when responses are gzip'ed, (as declared length != actual length). In this diff we just removed the header and let the webserver decided what to do instead (i.e. in most cases return chunked-content rather than set length): https://gist.github.com/hcooper/a1c7a882914679a0ccc9

  3. BONUS - switch Koken from using ImageMagick to GD instead (GD support is built into HHVM): https://gist.github.com/hcooper/081bc779d374eefa7293

commit e4b016d2cc93a3231eb55a9d3a8f16c8302c5488
Author: Hereward Cooper <coops@fawk.eu>
Date: Mon Jul 14 16:33:37 2014 -0700
switch from imagemagick to gd
diff --git a/storage/configuration/user_setup.php b/storage/configuration/user_setup.php
index 92e54db..ced961b 100755
--- a/storage/configuration/user_setup.php
+++ b/storage/configuration/user_setup.php
@hcooper
hcooper / [koken] disable_Content-Length.diff
Last active August 29, 2015 14:03
Koken calculates and returns a Content-Length header, regardless of the server is going to compress/chunk the response.
commit 74ae5fa6e841bbe1092cf6262fb6031b44fa9b4c
Author: Hereward Cooper <coops@fawk.eu>
Date: Mon Jul 14 14:46:17 2014 -0700
disabling content-length header
diff --git a/i.php b/i.php
index a6c704e..52446b2 100755
--- a/i.php
+++ b/i.php
@hcooper
hcooper / [koken] extract_classname.diff
Last active August 8, 2019 14:41
Koken depends on the positional output of get_declared_classes(), which can not be guaranteed. This extract the class name from the plugin instead.
diff --git a/app/application/libraries/shutter.php b/app/application/libraries/shutter.php
index 6308d6c..58f7127 100755
--- a/app/application/libraries/shutter.php
+++ b/app/application/libraries/shutter.php
@@ -68,6 +68,18 @@ class Shutter {
return $json;
}
+ // tokenize a given file, and extract the class name
+ public static function extract_classname($file) {
@hcooper
hcooper / koken-upload.py
Last active March 5, 2021 14:47
Upload photos to a koken gallery from the command line
# v1.0 of a command line uploader for the koken gallery software.
# The only non-standard requirement is pyton-requests.
import json
import requests
import os
from urllib import quote as quote
api_url = "http://yourdomain/api.php?"
common_headers = {'X-Koken-Auth':'cookie'}