Skip to content

Instantly share code, notes, and snippets.

View seblavoie's full-sized avatar

Sébastien Lavoie seblavoie

View GitHub Profile
# This shell function will convert a Quicktime file and convert it to a H.264 file using FFMPEG.
# Make sure you have FFMPEG installed. See https://superuser.com/questions/624561/install-ffmpeg-on-os-x for instructions.
mp4() {
ffmpeg -i "$1" -c:v libx264 -c:a aac -vf format=yuv420p -movflags +faststart "${1%.mov}.mp4"
open "${1%.mov}.mp4"
}
@seblavoie
seblavoie / harvest-invoices.js
Created January 5, 2021 04:56
Export and clean up Harvest invoices data
var data = []
$("tbody.has-clickable-table-rows tr").each(function() {
var $t = $(this)
var line = {
date: $t.find(".col-issue-date").text().trim(),
name: "#" + _cleanText($t.find(".col-id")) + "-" + _cleanText($t.find(".col-client")),
amount: _cleanNumber($t.find(".col-amount")),
@seblavoie
seblavoie / next.jsx
Created June 10, 2020 04:10
next.jsx
// The action to be performed. Next is 1, Prev is -1.
concat = 1;
activeComp = app.project.activeItem
// Propery is selected
if(activeComp.selectedProperties.length > 0) {
updateProperties()
}
// First layer has Frame
var _comp;
for (var i = 1; i <= app.project.numItems; i ++) {
if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name === '# Main')) {
_comp = app.project.item(i);
break;
}
}
var _checkbox = _comp.layer("Controller").Effects.property("Dev?")("Checkbox");
var _newValue = _checkbox.value == 1 ? 0 : 1;
@seblavoie
seblavoie / gist:ab6aa421944ca952422f665ebe0df4d3
Last active July 14, 2019 19:58
after effects wiggle expressions
// Found here http://www.motion-graphics-exchange.com/after-effects/Wiggle-rubber-bounce-throw-inertia-expressions/4ad0f32a944ad
fps=15; //frequency
amount=50; //amplitude
wiggle(fps,amount,octaves = 1, amp_mult = 0.5,(Math.round(time*fps))/fps);
Jumpy Wiggle 1 makes wiggle skip and hold rather than move fluidly.
// Jumpy Wiggle 1 (moves at a random FPS)
@seblavoie
seblavoie / gist:23a0a431273124e875460356e239d0a6
Last active June 5, 2019 02:00
copy files from photo library
cp **/*.(jpg|jpeg|png|JPG|JPEG|PNG|mov|MOV|mp4|MP4|gif|GIF) ~/Desktop/
@seblavoie
seblavoie / MultiExporter.jsx
Created February 5, 2019 17:32 — forked from TomByrne/MultiExporter.jsx
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to tom@tbyrne.org
@seblavoie
seblavoie / gist:b267021499f5294e65a7442494f908e0
Created January 31, 2018 17:05
After Effects nulls character rig
app.beginUndoGroup("Add character")
var activeComp = app.project.activeItem;
var wiggleExpression = 'seedRandom(index);wiggle(thisComp.layer("Controller").effect("Freq")("Slider"), thisComp.layer("Controller").effect("Amp")("Slider"))'
// Adding controller layer
var controllerLayer = activeComp.layers.addNull(activeComp.duration);
controllerLayer.name = "Controller";
effect = controllerLayer.Effects.addProperty("Slider Control");
effect.name = "Freq"
@seblavoie
seblavoie / sound-chunks.sh
Created August 23, 2016 02:49
Cut a given sound file in small chunks. Very useful for audiobooks.
# 1. Install mp4box via homebrew (or howerver you want).
# 2. Make sure you have a m4a file. You can take any audio .mp4 and just change the extension.
# 3. Adjust the chunk length (300 seconds in this case) and run this:
mp4box -split 300 source-file.m4a
// Use if there is *no* time remapping in parent comp.
parentComp = comp("# Main");
compStartTimeInParent = parentComp.layer(thisComp.name).startTime;
audioStartTimeInParent = parentComp.layer(thisLayer.name).startTime;
fullStartTime = this.startTime;
fullEndTime = this.source.duration+startTime;
linear(time, fullStartTime, fullEndTime, fullStartTime+compStartTimeInParent-audioStartTimeInParent, fullEndTime+compStartTimeInParent-audioStartTimeInParent)