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 | |
session_start(); | |
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' ); | |
$base = 1024; | |
if( !is_array($_SESSION['speed']) ) | |
{ | |
$_SESSION['speed'] = array('updated' => time(), 'old' => file_get_contents('/sys/class/net/eth0/statistics/rx_bytes')); |
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 | |
# | |
# video conversion script for publishing as HTML 5 video, via videojs (with hd button extension) | |
# 2011 by zpea | |
# feel free to use as public domain / Creative Commons CC0 1.0 (http://creativecommons.org/publicdomain/zero/1.0/) | |
# | |
FFMPEG=/usr/bin/ffmpeg | |
HD_SUFFIX='_hd' |
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 | |
class Test extends CI_Controller | |
{ | |
public function deploy_test() { | |
$connection = ssh2_connect("123.45.67.890", 23); | |
if(!$connection) { | |
echo json_encode('Connection failed'); | |
} |
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
# Get video duration in frames | |
duration=$(ffmpeg -i [filename] 2>&1 | sed -n "s/.* Duration: \([^,]*\), start: .*/\1/p") | |
fps=$(ffmpeg -i [filename] 2>&1 | sed -n "s/.*, \(.*\) tbr.*/\1/p") | |
hours=$(echo $duration | cut -d":" -f1) | |
minutes=$(echo $duration | cut -d":" -f2) | |
seconds=$(echo $duration | cut -d":" -f3) | |
FRAMES=$(echo "($hours*3600+$minutes*60+$seconds)*$fps" | bc | cut -d"." -f1) | |
# Start ffmpeg, use awk to flush the buffer and remove carriage returns | |
ffmpeg -i [filename] [options] [outputfile] 2>&1 | awk '1;{fflush()}' RS='\r\n'>[errorlog] & |
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
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide | |
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel | |
mkdir ~/ffmpeg_sources | |
cd ~/ffmpeg_sources | |
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz | |
tar xzvf yasm-1.2.0.tar.gz | |
cd yasm-1.2.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
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* CodeIgniter | |
* | |
* An open source application development framework for PHP 4.3.2 or newer | |
* | |
* @package CodeIgniter | |
* @author Rick Ellis | |
* @copyright Copyright (c) 2006, EllisLab, Inc. | |
* @license http://www.codeignitor.com/user_guide/license.html |
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
/** | |
* Check if a given ip is in a network | |
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1 | |
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed | |
* @return boolean true if the ip is in this range / false if not. | |
*/ | |
function ip_in_range( $ip, $range ) { | |
if ( strpos( $range, '/' ) == false ) { | |
$range .= '/32'; | |
} |
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 | |
# Backup a Plex database. | |
# Author Scott Smereka | |
# Version 1.0 | |
# Script Tested on: | |
# Ubuntu 12.04 on 2/2/2014 [ OK ] | |
# Plex Database Location. The trailing slash is |
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
makeWebm() { | |
FILE=$1 | |
BITRATE=${2:-'3450'} | |
SIZE=${3:-'1280x720'} | |
FILENAME=${FILE%%.*} | |
ffmpeg -i ${FILE} -acodec libvorbis -ac 2 -ab 96k -ar 44100 -b ${BITRATE}k -s ${SIZE} ${FILENAME}.webm | |
} | |
makeWebms() { | |
BITRATE=${1:-'3450'} |
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 | |
# Create an Iframe index from HLS segmented streams | |
# $1: Filename to be created | |
# $2: Location of segmented ts files | |
# Check how many arguments | |
if [ $# != 2 ]; then | |
echo "Usage: $0 [Input filename] [Location of segmented streams]" | |
exit 1; | |
fi |
OlderNewer