Skip to content

Instantly share code, notes, and snippets.

View patrick91's full-sized avatar

Patrick Arminio patrick91

View GitHub Profile
for f in *.srt; do
t=$(echo $f | sed 's/\.mov.srt$//' | tr '[:upper:]' '[:lower:]');
echo converting $f to $t.vtt
srt-to-vtt $f > $t.vtt
sed -i -e 's/<[^>]*>//g' $t.vtt
done
import sys
import glob
def add_line(filename):
out = []
with open(filename) as f:
for l in f:
if '-->' in l:
@patrick91
patrick91 / config.go
Last active September 15, 2018 11:43 — forked from agtorre/config.go
Store OAuth2 Token Using Datastore
// Config is a custom oauth2 config that is used to store the token
// in the datastore
type Config struct {
*oauth2.Config
}
// StoreToken is called when exchanging the token and saves the token
// in the datastore
func (c *Config) StoreToken(ctx context.Context, token *oauth2.Token) error {
log.Infof(ctx, "storing the token")
aws iam upload-server-certificate \
--server-certificate-name MixTheCitySha2 \
--certificate-body file://mixthecity.com.crt \
--private-key file://mixthecity.com.plain.key \
--certificate-chain file://sub.class1.server.sha2.ca.pem \
--path /cloudfront/mix-the-city/
def merge(range1, range2):
"""
returns a merged range if range can be merged,
otherwise returns False.
we suppose that range1[0] <= range2[0]
"""
if range1 == range2:
return range1
@patrick91
patrick91 / BasicAuthInterceptor.java
Created February 20, 2015 21:39
Picasso Basic Auth
import android.util.Base64;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
public class BasicAuthInterceptor implements Interceptor {
String username;
@patrick91
patrick91 / .gitignore
Created October 29, 2014 20:33
Android studio .gitignore
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
body {
color: #424242;
font: 21px/32px "Courier New";
}
h1 {
font-weight: normal;
font-family: Garamond;
{% load cms_tags sekizai_tags compressed static %}
{% if not request.is_ajax %}{% include "base_head.html" %}{% endif %}
<div class="main">
{% block base_content %}{% endblock %}
</div>
{% if not request.is_ajax %}{% include "base_foot.html" %}{% endif %}
@patrick91
patrick91 / jquery.autofitinput.js
Created December 11, 2013 17:17
Resize input according to its content.
(function ($) {
$.fn.autoFitInput = function (o) {
function getTestSubject(input, text) {
var testSubject = $('#input-tester');
if (testSubject.length === 0){
testSubject = $('<pre id="input-tester" />').appendTo('body').css({
position: 'absolute',
top: -9999,
left: -9999,