Skip to content

Instantly share code, notes, and snippets.

View cdgraff's full-sized avatar

AlejandroF cdgraff

View GitHub Profile
@cdgraff
cdgraff / td-agent.conf
Last active October 6, 2017 13:04
FluentD configuration
#Varnish HLS Stats
<source>
@type tail
format /(?<path>[^ ]*) (?<code>[^ ]*) (?<userid>[^ ]*)/
path /var/log/hls-access.log
pos_file /var/log/td-agent/hls-access.log.pos
tag td.varnish.userid
</source>
<filter td.varnish.userid>
varnishncsa -a -w /var/log/hls-access.log -D -F %{VCL_Log:url}x %s %{VCL_Log:userid}x
sub vcl_deliver {
std.log("userid:" + cookie.get("userid"));
std.log("url:" + req.url);
set resp.http.Access-Control-Allow-Origin = "http://your.site.here";
set resp.http.Access-Control-Allow-Credentials = "true";
if (resp.http.Content-Type ~ "application/vnd.apple.mpegurl") {
# Set a userid cookie on the client that lives for 60 minutes.
set resp.http.Set-Cookie = "userid=" + cookie.get("userid") + "; Expires=" + cookie.format_rfc1123(now, 60m) + "; httpOnly";
@cdgraff
cdgraff / varnish.recv.vcl
Last active November 8, 2020 13:11
Varnish VCL code examples for HLS stats
sub vcl_recv {
# Only userid are left in req.http.cookie at this point.
cookie.parse(req.http.cookie);
cookie.filter_except("userid");
if (cookie.isset("userid")) {
std.log("userid value is: " + cookie.get("userid"));
} else {
cookie.set("userid", regsub(std.random(0, 320000000), "\..*", ""));
std.log("userid value is: " + cookie.get("userid"));
}
@cdgraff
cdgraff / video.js
Last active February 19, 2017 23:46
video.js cookie support
hlsjsConfig: {
xhrSetup: (xhr, url) => { xhr.withCredentials = true }
}
@cdgraff
cdgraff / audioAds.xml
Last active July 20, 2016 05:36 — forked from KelvinJin/audioAds.xml
The xml file for audio ads. VAST format.
<VAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.0">
<Ad id="2967">
<InLine>
<AdSystem>Mixberry Media</AdSystem>
<Impression>
http://imp.mixberrymedia.com/impressions/capture?parameters=4UV3V8gq_qFhxdSloAjDv2sFtu6uQta0vRQG7haMxCYjgvBFmZx0vphz4-SbbX4KW6OMs9BvMUaEBoSltBh1ETMvRb8qAj_w0vIRlPyNwm35i1v9AFfhz-U2joq7A1bT
</Impression>
<Creatives>
<Creative AdID="2967">
<Linear>
@cdgraff
cdgraff / spec.md
Created November 21, 2015 02:11 — forked from ePirat/spec.md
Icecast Protocol specification

Icecast protocol specification

What is the Icecast protocol?

When speaking of the Icecast protocol here, actually it's just the HTTP protocol, and this document will explain further how source clients need to send data to Icecast.

HTTP PUT based protocol

Since Icecast version 2.4.0 there is support for the standard HTTP PUT method. The mountpoint to which to send the data is specified by the URL path.

@cdgraff
cdgraff / Error with influxdb-0.9.4_rc1-1.x86_64
Created September 13, 2015 02:01
Error with influxdb-0.9.4_rc1-1.x86_64
2015/09/12 21:57:02 InfluxDB starting, version 0.9.4-rc1, branch master, commit 6d028f9586a6fb3afda9f66bbea8dd7d59b9b3cd
2015/09/12 21:57:02 Go version go1.5, GOMAXPROCS set to 2
2015/09/12 21:57:02 Using configuration at: /etc/opt/influxdb/influxdb.conf
[metastore] 2015/09/12 21:57:02 Using data dir: /var/opt/influxdb/meta
[metastore] 2015/09/12 21:57:02 Skipping cluster join: already member of cluster: nodeId=1 raftEnabled=true peers=[localhost:8088]
[metastore] 2015/09/12 21:57:02 Node at localhost:8088 [Follower]
[metastore] 2015/09/12 21:57:03 Node at localhost:8088 [Leader]. peers=[localhost:8088]
[monitor] 2015/09/12 21:57:03 Starting monitor system
[metastore] 2015/09/12 21:57:03 Updated node id=1 hostname=localhost:8088
[monitor] 2015/09/12 21:57:03 'build' registered for diagnostics monitoring
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/j/vendor/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/j/vendor/underscore-min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/latest/clappr.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/bemtv/alpha/p2phls.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/bemtv/latest/p2phlsstats.min.js"></script>
<title>Globo Media Control Test Page</title>
[srvr] 2015/03/31 12:36:57 GOMAXPROCS set to 2
[srvr] 2015/03/31 12:36:57 influxdb started, version 0.9.0-rc17, commit 710f7130b68519d9edfd0493ddfcc995dfc11318
[srvr] 2015/03/31 12:36:57 broker opened at /tmp/influxdb/development/raft
[raft] server.com:8086 2015/03/31 12:36:57 log open: created at /tmp/influxdb/development/raft/raft, with ID 1, term 1, last applied index of 14062
[raft] server.com:8086 2015/03/31 12:36:57 log open: promoting to leader immediately
[raft] server.com:8086 2015/03/31 12:36:57 log state change: stopped => leader
[srvr] 2015/03/31 12:36:57 broker listening on 0.0.0.0:8086
[srvr] 2015/03/31 12:36:57 Loading metadata index for icestats
[messaging] 2015/03/31 12:36:57 reconnecting to broker: url={ <nil> /messaging/messages index=21&streaming=true&topicID=1 }, err=Get /messaging/messages?index=21&streaming=true&topicID=1: unsupported protocol scheme ""
[messaging] 2015/03/31 12:36:57 reconnecting to broker: url={ <nil> /messaging/messages index=0&streaming=true&topicID=2 }, err=Get