Skip to content

Instantly share code, notes, and snippets.

View cjfff's full-sized avatar
🎯
Focusing

JingFeng Chen cjfff

🎯
Focusing
View GitHub Profile
@cjfff
cjfff / .cz-config.js
Created July 3, 2020 14:49 — forked from leohxj/.cz-config.js
cz-customizable with emoji
'use strict';
module.exports = {
types: [
{
value: 'WIP',
name : '💪 WIP: Work in progress'
},
{
{"version":1,"resource":"file:///Users/joyy/Project/oneship-h5/src/containers/Order/Detail/index.tsx","entries":[{"id":"CIyY.tsx","timestamp":1650961506385},{"id":"ugCg.tsx","timestamp":1650973908866},{"id":"EDkI.tsx","timestamp":1650974260518},{"id":"IG8L.tsx","timestamp":1650974273054},{"id":"ciqt.tsx","timestamp":1650974294426},{"id":"dppA.tsx","timestamp":1650975002205},{"id":"Icxd.tsx","timestamp":1650975023017},{"id":"Fq8u.tsx","timestamp":1650978360697},{"id":"aOJZ.tsx","timestamp":1650979486854},{"id":"1WMf.tsx","timestamp":1650979505430},{"id":"thjD.tsx","timestamp":1650979971254},{"id":"gA4b.tsx","timestamp":1651028685128},{"id":"MVUm.tsx","timestamp":1651028706925},{"id":"lLKG.tsx","timestamp":1651028848187},{"id":"d39q.tsx","timestamp":1651028870966},{"id":"twGR.tsx","timestamp":1651029120292},{"id":"uj11.tsx","timestamp":1651030663997},{"id":"mTLS.tsx","timestamp":1651111459554},{"id":"Sd9l.tsx","timestamp":1651202605748},{"id":"efmk.tsx","timestamp":1652178471894}]}
@cjfff
cjfff / getMP4Length.js
Created July 22, 2020 23:59 — forked from Elements-/getMP4Length.js
Read the duration of a mp4 file nodejs
var buff = new Buffer(100);
fs.open(file, 'r', function(err, fd) {
fs.read(fd, buff, 0, 100, 0, function(err, bytesRead, buffer) {
var start = buffer.indexOf(new Buffer('mvhd')) + 17;
var timeScale = buffer.readUInt32BE(start, 4);
var duration = buffer.readUInt32BE(start + 4, 4);
var movieLength = Math.floor(duration/timeScale);
console.log('time scale: ' + timeScale);
console.log('duration: ' + duration);