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 / 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 / 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>
Verifying that +gridinoc is my blockchain ID. https://onename.com/gridinoc
@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</
@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 / 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()
export CI_BRANCH2=`echo $CI_BRANCH | sed "s/\//-/"`
sed -i "s/trint-v1-dev/trint-v1-$CI_BRANCH2/" .ebextensions/01papertrail.config

Current stack

  • AWS ElasticBeanstalk for node.js deployments
  • source code in GitHub
  • CI/CD with Codeship.com, which deploys to AWS ElasticBeanstalk and sends notifications to Slack
  • Slack.com for team communication
  • CommonKey.com for team password management
  • Librato.com for AWS monitoring and custom metrics (via Librato node lib), alerts in Librato wil post to Slack
  • Papertrail.com for aggregating node.js logs from AWS EB instances, custom searches and triggers will post to Slack
  • Filepicker.io for user uploads directly to S3
@Laurian
Laurian / app.js
Created September 13, 2014 06:05
var Ctx = Morearty.createContext(React, Immutable,
{ // initial state
page: 'HOME',
zoom: 5,
cursor: 0,
videos: {},
segments: [],
speakers: {}
},
{ // configuration
@Laurian
Laurian / 20mirror-outside-files
Created July 13, 2014 13:17
20mirror-outside-files
#!/bin/sh
set -e
# Based on nealmcb's + ErebusBat's script from http://serverfault.com/questions/211425/
# If you want other configuration data or files on the system also
# opportunistically tracked via etckeeper, use this script to copy them in.
# If there is a hook of some sort available related to the files
# you're mirroring, you can call etckeeper directly and track them