This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (keycode) { | |
//event key code list | |
const valid = | |
(keycode > 47 && keycode < 58) || // number keys | |
keycode == 32 || keycode == 13 || // spacebar & return key(s) (if you want to allow carriage returns) | |
keycode == 8 || keycode == 46 || // delete keys | |
(keycode > 64 && keycode < 91) || // letter keys | |
(keycode > 95 && keycode < 112) || // numpad keys | |
(keycode > 185 && keycode < 193) || // ;=,-./` (in order) | |
(keycode > 218 && keycode < 223); // [\]' (in order) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const multer = require('multer'); | |
const upload = multer(); | |
function sendUploadToGCS (req, res, next) { | |
if (!req.file) { | |
return next(); | |
} | |
const gcsname = `${PATH_TO_FILE}`; | |
const file = bucket.file(gcsname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var propertiesObject = { field1:'test1', field2:'test2' }; | |
request({url:url, qs:propertiesObject}, function(err, response, body) { | |
if(err) { console.log(err); return; } | |
console.log("Get response: " + response.statusCode); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import request from 'request' | |
import fs from 'fs' | |
const requestQuery = { | |
path: path | |
} | |
request({url: 'http://localhost:8080/getFile', qs: requestQuery}) | |
.on('response', (response) => { | |
//response chunks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
fs.writeFileSync(`${name}.json`, JSON.stringify(data)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -i input.mp4 -ss 00:00:10 -to 00:00:25 -c:v copy -c:a copy output.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -i yellowstonefinal.mp4 -vcodec copy -acodec copy -ss 00:00:00.000 -t 00:01:31.000 yellowstonetrimmed.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud functions deploy helloGCSGeneric --runtime nodejs8 --trigger-resource gs://storageurl.com --trigger-event google.storage.object.finalize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = https.get(url, (response) => { | |
if (response.statusCode === 200) { | |
var len = parseInt(response.headers['content-length'], 10); | |
var downloaded = 0 | |
response.pipe(fs.createWriteStream(filepath) | |
.on("error", (error) => { | |
//error | |
}) | |
.on('finish', () => { | |
//finish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const command = ffmpeg() | |
const commandArray = [] | |
command.addInput(`./best.mp4`) | |
command.addInput(`./best2.wav`) | |
commandArray.push(`[1]volume=0.1[a1]`) | |
command.addInput(`./voiceover.mp3`) | |
commandArray.push(`[2]volume=0.9[a2]`) | |
let ffmpegKeys = '[a1][a2]amix=inputs=2[a]' | |
commandArray.push(ffmpegKeys) |
OlderNewer