Skip to content

Instantly share code, notes, and snippets.

View svperfecta's full-sized avatar
👾

Brian Corrigan svperfecta

👾
View GitHub Profile
# The initial was for Varnish 2.1, this has been updated for Varnish 3.
# The upgrade changes were based on the docs here:
# https://www.varnish-cache.org/docs/3.0/installation/upgrade.html
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
@svperfecta
svperfecta / gist:7862975
Last active December 30, 2015 17:48
MySQL Admin
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database.* TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
DROP USER ‘demo’@‘localhost’;
{
schedules : [
{
name: 'logogarden',
content: [
{
type: 'imageList',
images: [
{
type: image
@svperfecta
svperfecta / gist:f01b7794e755e9a24e3a
Last active August 29, 2015 14:12
Terminal Stuff
# Automatically create or reattach to an iTerm session
tmux attach -t base || tmux new -s base
# SSH With no profile
ssh -T -i ~/.ssh/somekey user@server -t "bash --noprofile"
# Rsync using an identify file
rsync -avz --partial --progress --rsh="ssh -i $HOME/.ssh/somekey.pem" ~/somefile root@1.2.3.4:~/
@svperfecta
svperfecta / pclive
Created July 7, 2015 11:21
Poker Central Live Stream Playlist
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=314000,RESOLUTION=256x144,CODECS="avc1.77.30, mp4a.40.2"
http://ooyalahd2-f.akamaihd.net/i/crtv01_delivery@329705/index_282_av-b.m3u8?sd=10&rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=564000,RESOLUTION=512x288,CODECS="avc1.77.30, mp4a.40.2"
http://ooyalahd2-f.akamaihd.net/i/crtv01_delivery@329705/index_564_av-b.m3u8?sd=10&rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1163000,RESOLUTION=640x360,CODECS="avc1.77.30, mp4a.40.2"
http://ooyalahd2-f.akamaihd.net/i/crtv01_delivery@329705/index_1164_av-b.m3u8?sd=10&rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2464000,RESOLUTION=1280x720,CODECS="avc1.77.30, mp4a.40.2"
http://ooyalahd2-f.akamaihd.net/i/crtv01_delivery@329705/index_2528_av-b.m3u8?sd=10&rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,CODECS="mp4a.40.2"
@svperfecta
svperfecta / pcvod
Created July 7, 2015 11:24
Poker Central VOD Playlist
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2464000,RESOLUTION=1280x720
http://player.ooyala.com/player/appletv/Fpbzl1dTo65q-IuenkPBkqSLXlbKFYAz_2400.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1163000,RESOLUTION=640x360
http://player.ooyala.com/player/appletv/Fpbzl1dTo65q-IuenkPBkqSLXlbKFYAz_1200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=564000,RESOLUTION=1920x1080
http://player.ooyala.com/player/appletv/Fpbzl1dTo65q-IuenkPBkqSLXlbKFYAz_4400.m3u8
{
"data": {
"type": "view",
"attributes": {
"title": "Home Page",
"updatedAt": "2015-06-19T15:12:43.000Z",
"version": 1
},
"relationships": {
"featuredPromotion": {
@svperfecta
svperfecta / gist:141e7c1ae1e610c9cdcd
Last active January 21, 2016 20:33
Example Event RSS Feed

Feed will support xcal (xml representation of ical). This allows us to handle event schedules (PBR) in a nice way

Feed will also support the media rss spec as part of our RSS parsing. This allows a nice way to provide links to assets (images, video, etc) within the rss feed in a standardized way.

Both of these require the tag to add additional XML namespaces (xmlns:media, xmlns:xcal).

These are used within an RSS feed like so:

<?xml version="1.0"?>
<rss version="2.0"
@svperfecta
svperfecta / gist:bd7535b42e3658c63df0
Last active November 23, 2015 21:17
Example News RSS Feed

Feed will also support the media rss spec as part of our RSS parsing. This allows a nice way to provide links to assets (images, video, etc) within the rss feed in a standardized way.

This requires the tag to add additional XML namespaces (xmlns:media).

These are used within an RSS feed like so:

<?xml version="1.0"?>
<rss version="2.0"
    xmlns:xcal="urn:ietf:params:xml:ns:xcal"
>
sub vcl_recv {
if (req.http.X-OperaMini-Features || req.http.User-Agent ~ " Silk-Accelerated=true$") {
set geoip.use_x_forwarded_for = true;
}
set req.http.X-Geo-Country-Code = geoip.country_code;
set req.http.X-Real-IP = req.http.Fastly-Client-IP;
#FASTLY recv