running:
bash create-vod-hls.sh beach.mkv
will produce:
beach/
|- playlist.m3u8
|- 360p.m3u8
#with regex from http://detectmobilebrowsers.com/ | |
#map suggestion via kolbyjack | |
#not tested | |
map $http_user_agent $mobile_agent{ | |
default 0; | |
~* "android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino" 1; | |
~* "^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibr |
import sys | |
from datetime import datetime, timedelta | |
import praw | |
user_agent = "hot test 1.0 by /u/dangayle" | |
r = praw.Reddit(user_agent=user_agent) | |
class SubredditLatest(object): | |
"""Get all available submissions within a subreddit newer than x.""" |
import React from 'react'; | |
import Tachyons from 'tachyons/css/tachyons.min.css' | |
const App = () => ( | |
<div className="mw9 center"> | |
<h2 className="red sans-serif tc">Hello, world</h2> | |
</div> | |
); | |
export default App; |
"""Twitter bot that tweets a random line from a file. | |
Uses Twisted to periodically select a random line from an input file, | |
and Twython to post it to Twitter using your credentials. | |
Usage: python twitterbot.py file.txt, where each line in file.txt is | |
a single sentence terminated by a newline ('\n'). | |
""" | |
import sys |
$grid-gutter-width: 30px; | |
.l-1{ | |
// larger portion of golden ratio | |
width: calc(#{percentage(1/1.618)} - #{$grid-gutter-width / 2}); | |
} | |
.l-2{ | |
// Smaller portion of golden ratio | |
width: calc(#{percentage(1-1/1.618)} - #{$grid-gutter-width / 2}); | |
} |
from app import db | |
from sqlalchemy import func, types | |
from sqlalchemy.dialects import postgresql | |
class JSONCache(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
key = db.Column(db.String, nullable=False, index=True) | |
data = db.Column(postgresql.JSONB, nullable=False) | |
timestamp = db.Column(types.TIMESTAMP, server_default=func.now(), nullable=False) |
running:
bash create-vod-hls.sh beach.mkv
will produce:
beach/
|- playlist.m3u8
|- 360p.m3u8
mkdir dash && \ | |
ffmpeg -hide_banner -i original.mkv -c:v libvpx-vp9 -row-mt 1 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 \ | |
-movflags faststart -f webm -dash 1 -speed 3 -threads 4 -an -vf scale=426:240 -b:v 400k -r 30 -dash 1 dash/426x240-30-400k.webm && \ | |
ffmpeg -hide_banner -i original.mkv -c:v libvpx-vp9 -row-mt 1 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 \ | |
-movflags faststart -f webm -dash 1 -speed 3 -threads 4 -an -vf scale=426:240 -b:v 600k -r 30 -dash 1 dash/426x240-30-600k.webm && \ | |
ffmpeg -hide_banner -i original.mkv -c:v libvpx-vp9 -row-mt 1 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 \ | |
-movflags faststart -f webm -dash 1 -speed 3 -threads 4 -an -vf scale=640:360 -b:v 700k -r 30 -dash 1 dash/640x360-30-700k.webm && \ | |
ffmpeg -hide_banner -i original.mkv -c:v libvpx-vp9 -row-mt 1 -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 \ | |
-movflags faststart -f webm -dash 1 -speed 3 -threads 4 -an -vf scale=640:360 -b:v 900k -r 30 -dash 1 dash/640x360-30-900k.we |
/* | |
No jQuery necessary. | |
Thanks to Dan's StackOverflow answer for this: | |
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport | |
*/ | |
function isElementInViewport(el) { | |
var rect = el.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 && |
from textblob.classifiers import NaiveBayesClassifier | |
from textblob import TextBlob | |
train = [ | |
('Take me off', 'stop'), | |
('Stop texting','stop'), | |
('stop messaging','stop'), | |
('Don\'t talk', 'stop'), | |
('Stop messaging','stop'), | |
('dont want to talk anymore','stop'), |