Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tryvin's full-sized avatar

Vin tryvin

View GitHub Profile
@tryvin
tryvin / tvheadend-fetch.js
Last active October 6, 2023 16:36
TVHeadend JS functions to help handling some copy
function getAllMuxes() {
return fetch('/api/mpegts/mux/grid',
{
body: 'start=0&limit=999999999&sort=name&dir=ASC', method: 'POST',
credentials: 'include',
headers: {
'Accept': 'application/json, application/xml, text/plain, text/html, *.*',
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
}
}
@tryvin
tryvin / mplayer.sh
Created February 21, 2018 14:03
mPlayer output to TvHeadend
#!/bin/bash
#This file can be used as a pipe script to TVHEADEND, as we know, IPTV is not reliable,
#and so, we need some buffers, as I didnt find any buffer options at ffmpeg, nor avconv, I used mplayer dumpstream.
#modify it as you need.
#Use a trap to kill mplayer and remove the fifo
trap 'kill -9 $PID && rm -f /home/hts/dump.stream 2>/dev/null' EXIT
@tryvin
tryvin / class.sandboxPluginLoader.php
Created March 7, 2016 14:02
A basic class to use when loading plugins in a controlled environment within PHP, this class uses runkit to redefine the functions, adding some random prefix, and controlling the access to these functions, like file parameters base dir and such
<?php
class sandboxPluginLoader {
private $fileSystemFunctionsMap = array(
'realpath' => 0,
'chgrp' => 0, 'chmod' => 0, 'chown' => 0,
'unlink' => 0, 'copy' => array(0, 1), 'file' => 0,
'file_exists' => 0, 'file_get_contents' => 0, 'file_put_contents' => 0,
'flock' => 0, 'fopen' => 0, 'glob' => 0,
'link' => array(0, 1), 'readfile' => 0, 'readlink' => 0,
'rename' => array(0, 1), 'rmdir' => 0,
@tryvin
tryvin / restful-model.php
Last active November 30, 2015 18:43
Restful model
<?php
class MyRestfulHandler extends BaseRestfulHandler {
/**
* @url GET /users
*/
public function getusers() {
return $userList;
}
/**
@tryvin
tryvin / tumbler-gist-insert.html
Created November 1, 2015 14:52
Tumblr gist insert
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script type="text/javascript">
$(function() {
$("a[href]").each(
function(index, element) {
if ( $(element).attr('href').indexOf('gist.github.com') > 0 ) {
var divElement = $('<div></div>');
$(element).after(divElement);
writeCapture.html(divElement, '<script src="'+$(element).attr('href')+'.js"></'+'script>');
@tryvin
tryvin / lambdaExample2.php
Created November 1, 2015 14:32
Lambda example 2
<?php
$myDatabaseArray = array(
array(
'databaseId' => 1,
'databaseValue' => 'Hello'
),
array(
'databaseId' => 2,
'databaseValue' => 'World'
)
@tryvin
tryvin / lambdaExample1.php
Created November 1, 2015 14:07
PHP lambda example - 1
<?php
$myDatabaseArray = array(
array(
'databaseId' => 1,
'databaseValue' => 'Hello'
),
array(
'databaseId' => 2,
'databaseValue' => 'World'
)