Skip to content

Instantly share code, notes, and snippets.

View Zegnat's full-sized avatar

Martijn van der Ven Zegnat

View GitHub Profile
<?php
/**
* A minimal PhotoBackup API endpoint developed in PHP.
*
* @version 1.0.0
* @author Martijn van der Ven <martijn@zegnat.net>
* @copyright 2015 Martijn van der Ven
* @license http://opensource.org/licenses/MIT The MIT License
*/
/**
* Send JSON encoded data to the browser and end all further processing.
* @method endWithJson
* @param array $data A data array.
* @throws InvalidArgumentException
* @return void
*/
private function endWithJson($data)
{
if (!is_array($data)) {
@Zegnat
Zegnat / License.txt
Created January 2, 2016 21:50
OmniMix Uno End User License Agreement
LICENSE AGREEMENT
OmniMix Uno End User License Agreement
Copyright (c) 2006 - 2015, Christian Danner - https://www.danner-net.de/om.htm.
All rights reserved.
THIS IS A LEGAL AGREEMENT between "you", the end user of the OmniMix Uno software, and Christian Danner, its author.
@Zegnat
Zegnat / .bash_minidlna
Last active April 24, 2016 19:20
These are the aliases I have configured to control my MiniDLNA set-up.
# Running DLNA server via `minidlnad`
alias dlna_remove_log="if [ -f ~/.config/minidlna/minidlna.log ];then rm ~/.config/minidlna/minidlna.log;fi"
alias dlna_stop="if [ -f ~/.config/minidlna/minidlna.pid ];then cat ~/.config/minidlna/minidlna.pid | xargs kill;fi"
alias dlna_init="minidlnad -f ~/.config/minidlna/minidlna.conf -P ~/.config/minidlna/minidlna.pid"
alias dlna_start="dlna_stop;dlna_remove_log;dlna_init"
alias dlna_rescan="dlna_stop;dlna_remove_log;dlna_init -R"
@Zegnat
Zegnat / password.php
Created September 8, 2015 17:37
Replacement getkirby/toolkit/lib/password.php using PHP 5.5 password_* functions and paragonie/password_lock inspired SHA512 pre-hashing to support passwords with more than 72 characters.
<?php
class Password {
static public function hash($plaintext) {
return password_hash(base64_encode(hash('sha512', $plaintext, true)), PASSWORD_DEFAULT);
}
static public function isHash($hash) {
$info = password_get_info($hash);
return $info['algo'] !== 0;
}
// ==UserScript==
// @name Fix YouTube
// @author no6019
// @match http://ndss.nl/*
// @version 0.0.2
// @grant none
// ==/UserScript==
/*jslint browser, for, maxlen: 80 */
(function () {
@Zegnat
Zegnat / spammers.txt
Created June 14, 2015 19:08
Adding 33 items to `spammers.txt`. From pull request #13.
10.17.10.18
100dollars-seo.com
12masterov.com
216.239.32.20
4webmasters.org
7makemoneyonline.com
Get-Free-Traffic-Now.com
acads.net
adcash.com
addons.mozilla.org
' T = BASE
' I = BASE 10 INPUT
' O = OUTPUT
2→T:87→I:0→O
log T→L
While I>0
Int (log I÷L)→S
I-T^S→I
O+10^S→O
WhileEnd
@Zegnat
Zegnat / IndieRoyaleHiderOfMisses.user.js
Created January 23, 2015 12:57
Userscript: removes all the IndieRoyale bundles (royals) you haven’t bought from your collection page.
// ==UserScript==
// @name IndieRoyale Hider of Misses
// @namespace http://zegnat.net/
// @version 0.1
// @description Removes all the bundles you haven’t bought from your collection page.
// @author Martijn van der Ven
// @license MIT <http://opensource.org/licenses/MIT>
// @match http://www.indieroyale.com/collection
// @grant none
// ==/UserScript==
@Zegnat
Zegnat / TwitchToolsM3UGenerator.user.js
Last active August 29, 2015 14:13
Userscript: Generate a playlist link for Twitch Tools’s Download Videos feature, for easy playing of video source files in your media player.
// ==UserScript==
// @name Twitch Tools Playlist Generator
// @namespace http://zegnat.net/
// @version 2.0
// @description Generate a playlist link for Twitch Tools’s Download Videos feature, for easy playing of video source files in your media player.
// @author Martijn van der Ven
// @license MIT <http://opensource.org/licenses/MIT>
// @match https://twitchtools.com/video-download
// @grant none
// @noframes