Skip to content

Instantly share code, notes, and snippets.

View jochemstoel's full-sized avatar
💭
Dematerializing

Jochem Stoel jochemstoel

💭
Dematerializing
View GitHub Profile
if (Device.canEvaluateFingerPrint) {
// here scan fingerprint method can be called
} else {
// biometry is not available for that device
}
@jochemstoel
jochemstoel / ffmpeg-watermark.md
Created December 2, 2020 20:24 — forked from bennylope/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

@jochemstoel
jochemstoel / shuffle.js
Created October 26, 2020 03:04 — forked from iSWORD/shuffle.js
Shuffle & Unshuffle an Array in JavaScript & Swift
// Functions
let shuffle = (inArr, seed, unshuffle = false) => {
let outArr = Array.from(inArr),
len = inArr.length
let swap = (a, b) => [outArr[a], outArr[b]] = [outArr[b], outArr[a]]
for (
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!--
Tutorial code for: http://www.binpress.com/tutorial/generating-nice-movie-previews-with-ffmpeg/138
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body>
<a href="https://www.youtube.com/watch?v=v1uyQZNg2vE" target="_blank" class="video-preview" data-frames="100" data-source="http://i.imgur.com/BX0pV4J.jpg"></a>
/**
* @this {Promise}
*/
function finallyConstructor(callback) {
var constructor = this.constructor;
return this.then(
function(value) {
// @ts-ignore
return constructor.resolve(callback()).then(function() {
return value;
# draw a bunch of samples
def random_walk(png, Gs, cx, cy, cw, ch, step, seeds):
print(png)
latents = np.stack(np.random.RandomState(seed).randn(Gs.input_shape[1]) for seed in seeds)
# images = Gs.run(latents, None, **synthesis_kwargs) # [seed, y, x, rgb]
idx = 0
for idxx, (l1, l2) in enumerate(zip(latents, latents[1:])):
print(idxx, '/', len(latents))
latent = np.stack([l1 * (1-alpha) + l2 * alpha for alpha in np.linspace(0, 1, step)])
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
function circularJSONStringify(obj) {
const cache = [];
const result = JSON.stringify(obj, (key, value) => {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Circular reference found, discard key
return;
}
// Store value in our collection
cache.push(value);
@jochemstoel
jochemstoel / extend.js
Created January 30, 2019 22:37 — forked from cferdinandi/extend.js
A native JS extend() function.
/**
* Merge defaults with user options
* @private
* @param {Object} defaults Default settings
* @param {Object} options User options
* @returns {Object} Merged values of defaults and options
*/
var extend = function ( defaults, options ) {
var extended = {};
var prop;