Skip to content

Instantly share code, notes, and snippets.

@leanderlee
leanderlee / hls.sh
Created November 8, 2024 20:20 — forked from stenuto/hls.sh
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
@leanderlee
leanderlee / inheritance.js
Last active August 29, 2015 14:05
Object Inheritance
var inheritable = function (self) {
var obj = { base: self };
for (var i in self) {
obj[i] = self[i];
}
return obj;
}
var inherit = function (base) {
var self = { base: base || {} };
for (var i in self.base) {
/*jshint browser:true */
/*global Avc:true, YUVWebGLCanvas: true, Size: true, requestAnimationFrame:true */
/* requestAnimationFrame polyfill: */
(function (window) {
'use strict';
var lastTime = 0,
vendors = ['ms', 'moz', 'webkit', 'o'],
x,
length,
functor Intersection (structure Spec1:DFASIG structure Spec2:DFASIG) : DFASIG
= struct
fun make_accept' x [] = []
| make_accept' x (y::ys) = ((x,y)::(make_accept' x ys));
fun make_accept [] y = []
| make_accept (x::xs) y = (make_accept' x y)@(make_accept xs y);
type Q = Spec1.Q * Spec2.Q
type Sigma = Spec1.Sigma * Spec2.Sigma
val init = (Spec1.init, Spec2.init)
val delta = fn ((s1,s2), (x1,x2)) => (Spec1.delta(s1,x1), Spec2.delta(s2,x2))
def createGeoreference(controlPoints):
x, y, xp, yp, x2, y2, xp2, yp2 = controlPoints
a = np.array([x - x2, y - y2])
b = np.array([xp - xp2, yp - yp2])
c = (np.dot(b / np.linalg.norm(b), a / np.linalg.norm(a)))
r = math.acos(c)
#case for negative angle between vectors
{"frames":[{"name":"Floor 1","perspective":"Perspective1","width":"820","height":"480","id":"4ebcd788a2c11592694188ab"},{"name":"Floor 2","y":"480","width":"173","height":"173","id":"4ebcd788a2c11592694188ab"},{"name":"Floor 2","x":"173","y":"480","width":"173","height":"173","id":"4ebcd788a2c11592694188ab"},{"name":"Floor 3","x":"346","y":"480","width":"173","height":"173","id":"4ebcd788a2c11592694188ab"}]}
{
building: "conestoga-mall",
name: "Main Floor 2",
shortName: "F1",
colour: "#fbfbfb",
height: "6350",
width: "7267",
id: "4ebcd788a2c11592694188ab",
tiles: "http://localhost:8080/content/conestoga-mall/iso2_files/",
group: null,
@leanderlee
leanderlee / async.js
Created August 25, 2012 00:30
async stack test
var async = require("async");
var generateTask = function (num) {
return function (callback) {
callback(null, 'The number is at ' + num);
}
}
var tasks = [];
for (var i = 0; i < 1000000; i++) {