Skip to content

Instantly share code, notes, and snippets.

View joe-oli's full-sized avatar
💭
what the flock? no status to report, i am not a facebook junkie.

joe-oli

💭
what the flock? no status to report, i am not a facebook junkie.
View GitHub Profile
@joe-oli
joe-oli / MinimalAPIs.md
Created September 1, 2022 20:27 — forked from davidfowl/MinimalAPIs.md
Minimal APIs at a glance
@joe-oli
joe-oli / js-object-iteration.md
Created August 6, 2022 16:18 — forked from butterybread/js-object-iteration.md
How to iterate over object properties

Iterating over object properties

var foo = {bar: 'test'};

Object.keys(foo).forEach( function(key) {
    // property name
    console.log(key);
    // property value
    console.log(foo[key]);
});
@joe-oli
joe-oli / gist:9f110090d682353d3013ab31fa417dc3
Created July 3, 2022 09:26 — forked from eviltester/gist:7beef92896fdd8b638656f996fac38c0
Convert videos into subtitled sections using ffmpeg
# Create a new caption file
~~~~~~~~
ffmpeg -i captions.srt captions.ass
~~~~~~~~
# Add subtitles to main video without changing it
~~~~~~~~
ffmpeg -i video.mp4 -vf "subtitles=captions.ass:force_style='OutlineColour=&H80000000,BorderStyle=4,Outline=1,Shadow=0,MarginV=20'" subtitled-video.mp4
@joe-oli
joe-oli / promises.js
Created December 31, 2021 06:27 — forked from santisbon/promises.js
Promises example based on Mozilla Developer Network documentation
/*jslint devel: true, browser: true, es5: true */
/*global Promise */
var promiseCount = 0;
function testPromise() {
'use strict';
promiseCount += 1;
var thisPromiseCount = promiseCount;
@joe-oli
joe-oli / XMLHttpRequestPromise.js
Created December 31, 2021 06:27 — forked from santisbon/XMLHttpRequestPromise.js
Shows the implementation of a method which uses a Promise to report the success or failure of an XMLHttpRequest. Based on Mozilla Developer Network documentation.
/*jslint devel: true, browser: true, es5: true */
/*global Promise */
// $http function is implemented in order to follow the standard Adapter pattern
function $http(url) {
'use strict';
var core = {
// Method that performs the ajax request
ajax : function (method, url, args) {
@joe-oli
joe-oli / XMLHttpRequestLoadImagePromise.js
Created December 31, 2021 06:27 — forked from santisbon/XMLHttpRequestLoadImagePromise.js
Using XMLHttpRequest to load an image in a promise. Based on Mozilla Developer Network documentation.
/*jslint devel: true, browser: true, es5: true */
/*global Promise */
function imgLoad(url) {
'use strict';
// Create new promise with the Promise() constructor;
// This has as its argument a function with two parameters, resolve and reject
return new Promise(function (resolve, reject) {
// Standard XHR to load an image
var request = new XMLHttpRequest();
@joe-oli
joe-oli / ProcessHelper.cs
Created December 9, 2021 11:58 — forked from AlexMAS/ProcessHelper.cs
The right way to run external process in .NET
public static class ProcessHelper
{
public static ProcessResult ExecuteShellCommand(string command, string arguments, int timeout)
{
var result = new ProcessResult();
using (var process = new Process())
{
process.StartInfo.FileName = command;
process.StartInfo.Arguments = arguments;
@joe-oli
joe-oli / ProcessAsyncHelper.cs
Created December 9, 2021 11:56 — forked from AlexMAS/ProcessAsyncHelper.cs
The right way to run external process in .NET (async version)
using System;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
public static class ProcessAsyncHelper
{
public static async Task<ProcessResult> ExecuteShellCommand(string command, string arguments, int timeout)
{
var result = new ProcessResult();
----------------------------------------------------------------------------------------------------------------------------------
Converting a series of jpeg images to a mp4 video:
ffmpeg.exe -f image2 -r 3 -i %06d.jpeg -r 15 -vcodec mpeg4 -s 352x240 Camera-0.avi
-f image2 => input format
-r 3 => input framerate
-i %06d.jpeg => input mask (files must be named sequencially, with 6 digits. Ex: "000000.jpeg", "000001.jpeg", "000002.jpeg", etc)
-vcodec mpeg4 => video output codec
-s 352x240 => resolution

Windows 10 version 2004 - Installing Node.js on Windows Subsystem for Linux (WSL/WSL2)

UPDATE (Fall 2020): This gist is an updated version to the Windows 10 Fall Creators Update - Installing Node.js on Windows Subsystem for Linux (WSL) guide, I usually just keep here notes, configuration or short guides for personal use, it was nice to know it also helps other ppl, I hope this one too.

Windows updated windows subsystem for linux to version 2, as the F.A.Q stated you can still use WSL version 1 side by side with version 2. I'm not sure about existing WSL machines surviving the upgrade process, but as always backup and 🤞. NOTE: WSL version 1 is not replace/deprecated, and there ar