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
public class Main { | |
public static void main(String[] args) { | |
Set<String> ingredients = new HashSet(); | |
Set<String> allergens = new HashSet(); | |
for (int i = 0; i < args.length(); i++) { | |
String[] cols = args.get(i).split(" (contains "); | |
String[] ings = cols[0].split(" "); | |
for (Sring ing : ings) { | |
ingredients.add(ing); |
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
/** | |
* Link to the problem: http://lisperator.net/blog/a-little-javascript-problem/ | |
*/ | |
const node = (val) => (next) => (key) => { | |
return (key === 'value' ? val : next); | |
}; | |
const range = (start, end) => { | |
return (start === end ? node(end)(null) : node(start)(range(++start, end))); | |
}; |
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'); | |
const { createFFmpeg, fetchFile } = require('@ffmpeg/ffmpeg'); | |
const ffmpeg = createFFmpeg({ log: true }); | |
(async () => { | |
await ffmpeg.load(); | |
ffmpeg.FS('writeFile', 'test.avi', await fetchFile('./test.avi')); | |
await ffmpeg.run('-i', 'test.avi', 'test.mp4'); | |
fs.writeFileSync('./test.mp4', ffmpeg.FS('readFile', 'test.mp4')); | |
process.exit(0); | |
})(); |
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
<html> | |
<head> | |
<style> | |
html, body { | |
margin: 0; | |
width: 100%; | |
height: 100% | |
} | |
body { | |
display: flex; |
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
#!/bin/bash -x | |
# ... | |
CONFIG_ARGS=( | |
--target-os=none # use none to prevent any os specific configurations | |
--arch=x86_32 # use x86_32 to achieve minimal architectural optimization | |
--enable-cross-compile # enable cross compile | |
--disable-x86asm # disable x86 asm | |
--disable-inline-asm # disable inline asm |
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
#!/bin/bash -x | |
ARGS=( | |
--host=i686-gnu # use i686 gnu | |
--enable-static # enable building static library | |
--disable-cli # disable cli tools | |
--disable-asm # disable asm optimization | |
--extra-cflags="-s USE_PTHREADS=1" # pass this flags for using pthreads | |
) | |
emconfigure ./configure "${ARGS[@]}" |
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'); | |
const Module = require('./dist/ffmpeg-core'); | |
Module.onRuntimeInitialized = () => { | |
const data = Uint8Array.from(fs.readFileSync('./flame.avi')); | |
Module.FS.writeFile('flame.avi', data); | |
const ffmpeg = Module.cwrap('proxy_main', 'number', ['number', 'number']); | |
const args = ['ffmpeg', '-hide_banner', '-report', '-i', 'flame.avi', 'flame.mp4']; | |
const argsPtr = Module._malloc(args.length * Uint32Array.BYTES_PER_ELEMENT); |
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'); | |
const Module = require('./dist/ffmpeg-core'); | |
Module.onRuntimeInitialized = () => { | |
const data = Uint8Array.from(fs.readFileSync('./flame.avi')); | |
Module.FS.writeFile('flame.avi', data); | |
const ffmpeg = Module.cwrap('proxy_main', 'number', ['number', 'number']); | |
const args = ['ffmpeg', '-hide_banner']; | |
const argsPtr = Module._malloc(args.length * Uint32Array.BYTES_PER_ELEMENT); |
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 Module = require('./dist/ffmpeg-core'); | |
Module.onRuntimeInitialized = () => { | |
const ffmpeg = Module.cwrap('proxy_main', 'number', ['number', 'number']); | |
const args = ['ffmpeg', '-hide_banner']; | |
const argsPtr = Module._malloc(args.length * Uint32Array.BYTES_PER_ELEMENT); | |
args.forEach((s, idx) => { | |
const buf = Module._malloc(s.length + 1); | |
Module.writeAsciiToMemory(s, buf); | |
Module.setValue(argsPtr + (Uint32Array.BYTES_PER_ELEMENT * idx), buf, 'i32'); |
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 ptrs = [123, 3455]; | |
const buf = Module._malloc(ptrs.length * Uint32Array.BYTES_PER_ELEMENT); | |
ptrs.forEach((p, idx) => { | |
Module.setValue(buf + (Uint32Array.BYTES_PER_ELEMENT * idx), p, 'i32'); | |
}); |