Skip to content

Instantly share code, notes, and snippets.

View Laurian's full-sized avatar

Laurian Gridinoc Laurian

  • Creative Technologist ※ Knight-Mozilla OpenNews Fellow ※ Visual analytics × Computational Linguistics × Semantic Web
  • Cyberspace
  • X @gridinoc
View GitHub Profile
@Laurian
Laurian / dropbox.js
Created April 22, 2015 15:54
How to get the Dropbox access token server-side (express.js) with https://github.com/dropbox/dropbox-js, inspired by https://gist.github.com/davidmerfield/9335c6f7506091ad606e
app.get('/dropbox/auth', function(req, res) {
var client = new Dropbox.Client({ key: "*********", secret: "*********"});
client.authDriver({
authType: function() {return "code";},
url: function() {return "https://SERVER/dropbox/auth-callback";},
doAuthorize: function(authUrl, stateParam, client, callback) {
res.redirect(authUrl);// redirect to Dropbox
},
oauthQueryParams: ['access_token', 'expires_in', 'scope', 'token_type', 'code', 'error', 'error_description', 'error_uri', 'mac_key', 'mac_algorithm'].sort()
@Laurian
Laurian / styles.less
Created June 8, 2015 14:07
Atom style.less that disables Fira Code ligatures on current line, for easier editing. See it in action: http://gfycat.com/LeftRequiredCrownofthornsstarfish
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/
@Laurian
Laurian / title.html
Last active September 29, 2015 10:34
Royal Opera House registration titles
<select id="register_Title" name="register[Title]" class="no-js-styling"><option value="0">Miss</option><option value="1">Mr</option><option value="2">Mrs</option><option value="3">Ms</option><option value="4">Mx</option><option value="5">Other</option></select>
<select id="register_Prefix" name="register[Prefix]" class="no-js-styling selectBox" ><option value="0">Advocate</option><option value="1">Ambassador</option><option value="2">Baron</option><option value="3">Baroness</option><option value="4">Brigadier</option><option value="5">Canon</option><option value="6">Captain</option><option value="7">Chancellor</option><option value="8">Chief</option><option value="9">Col</option><option value="10">Comdr</option><option value="11">Commodore</option><option value="12">Councillor</option><option value="13">Count</option><option value="14">Countess</option><option value="15">Dame</option><option value="16">Dr</option><option value="17">Duke of</option><option value="18">Earl</option><option value="19">Earl of</
Verifying that +gridinoc is my blockchain ID. https://onename.com/gridinoc
@Laurian
Laurian / index.html
Created December 2, 2015 11:33
JSON to PNG
<!-- copy of http://jsfiddle.net/SzPMj/7/ found via http://www.devnetwork.net/viewtopic.php?f=50&t=133566 -->
<style>
body{
padding:50px;
}
canvas,img{
zoom:2000%;
}
</style>
@Laurian
Laurian / subtitles.py
Created January 20, 2016 20:18
movie.py subtitles example
from moviepy.editor import *
from moviepy.video.tools.subtitles import SubtitlesClip
generator = lambda txt: TextClip(txt, font='Arial', fontsize=16, color='white')
subtitles = SubtitlesClip("somet.srt", generator)
video = VideoFileClip("some.mp4")
result = CompositeVideoClip([video, subtitles.set_pos(('center','bottom'))])
result.write_videofile("out.mp4", fps=video.fps, temp_audiofile="temp-audio.m4a", remove_temp=True, codec="libx264", audio_codec="aac")
@Laurian
Laurian / README.md
Created August 19, 2016 18:31
VideoStitch with URLs (videos from PalestineRemix.com)

To allow URLs I had to modify https://github.com/ArsalanDotMe/VideoStitch/blob/master/lib/videoconcat.js#L48

let child = shelljs.exec(`ffmpeg -f concat -i ${args.fileList} -c copy ${outputFileName}`, { async: true, silent: spec.silent });

to

let child = shelljs.exec(`ffmpeg -f concat -safe 0 -protocol_whitelist file,http,https,tcp,tls -i ${args.fileList} -c copy ${outputFileName}`, { async: true, silent: spec.silent });
@Laurian
Laurian / Dockerfile
Last active October 13, 2016 01:36
Simple fix for local file changes for https://github.com/nypublicradio/audiogram
FROM ubuntu:16.04
# Install dependencies
RUN apt-get update --yes && apt-get upgrade --yes
RUN apt-get install git nodejs npm \
libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++ \
ffmpeg \
libgroove-dev zlib1g-dev libpng-dev \
redis-server --yes
@Laurian
Laurian / handlebars.tag
Created September 14, 2017 23:59
Handlebars.tag (JSP), `<h:handlebars template="example" context="${pageContext}" />`
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ tag import="java.util.*" %>
<%@ tag import="com.github.jknack.handlebars.io.TemplateLoader" %>
<%@ tag import="com.github.jknack.handlebars.io.ServletContextTemplateLoader" %>
<%@ tag import="com.github.jknack.handlebars.Handlebars" %>
<%@ tag import="com.github.jknack.handlebars.Template" %>
<%@ tag import="com.github.jknack.handlebars.Context" %>
<%@ attribute name="template" required="true" %>
<%@ attribute name="context" required="true" type="javax.servlet.jsp.PageContext" %>
<%
@Laurian
Laurian / database.cnf
Created November 16, 2017 17:31
Experimental: reading dpwe/audfprint signatures into mysql using worldveil/dejavu code
{
"database": {
"host": "127.0.0.1",
"user": "root",
"passwd": "",
"db": "dejavu"
}
}