const pluck = key => array => Array.from(new Set(array.map(obj => obj[key])));
if ('NodeList' in window && !NodeList.prototype.forEach) { | |
console.info('polyfill for IE11'); | |
NodeList.prototype.forEach = function (callback, thisArg) { | |
thisArg = thisArg || window; | |
for (var i = 0; i < this.length; i++) { | |
callback.call(thisArg, this[i], i, this); | |
} | |
}; | |
} |
'use strict'; | |
function parseTime(s) { | |
let t = 0; | |
const p = s.split(':'); | |
let ss = p.pop().replace(',', '.'); | |
t += parseFloat(ss); | |
ss = parseInt( p.pop() || '0', 10); | |
t += ss * 60; | |
ss = parseInt( p.pop() || '0', 10); |
function onOpen() { | |
var ui = DocumentApp.getUi(); | |
ui.createMenu('Convert to .RST') | |
.addItem('Convert to .RST and email me the result', 'ConvertToRestructuredText') | |
.addToUi(); | |
} | |
// Adopted from https://github.com/mangini/gdocs2md by Renato Mangini | |
// License: Apache License Version 2.0 | |
String.prototype.repeat = String.prototype.repeat || function(num) { |
Essentially just copy the existing video and audio stream as is into a new container, no funny business!
The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.
With ffmpeg
this can be achieved with -c copy
. Older examples may use -vcodec copy -acodec copy
which does the same thing.
These examples assume ffmpeg
is in your PATH
. If not just substitute with the full path to your ffmpeg binary.
var request = require('request'); | |
var fs = require('fs'); | |
var sox = require('sox'); | |
var spawn = require('child_process').spawn; | |
var WATSON_USER = ''; | |
var WATSON_PASS = ''; | |
var url = 'https://stream.watsonplatform.net/speech-to-text/api/v1/recognize'; | |
Back up podcasts with metadata from a feed URL. Progress indicator and resuming. Hacky, only really tested against FeedBurner/libsyn feeds.
When you run it, you get a directory named after the podcast with a list of mp3
files and metadata.json
files.
tree /mnt/backups/podcast/
/mnt/backups/podcast/
Sublime Text includes a command line tool, subl
, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.
- Sublime text 2 or 3 installed in your system within
Applications
folder
Setup
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |
Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.
In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.
Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j