Skip to content

Instantly share code, notes, and snippets.

Avatar

Vivek Haldar vivekhaldar

View GitHub Profile
View color_edit.py
#!/usr/bin/env python
import math
import sys
from moviepy.editor import AudioClip, VideoFileClip, concatenate_videoclips
# Get average RGB of part of a frame. Frame is H * W * 3 (rgb)
# Assumes x1 < x2, y1 < y2
@vivekhaldar
vivekhaldar / cut_silence.py
Last active Dec 27, 2020
Python script to cut out silent parts from a video. Uses moviepy.
View cut_silence.py
#!/usr/bin/env python
#
# Based on a script by Donald Feury
# https://gitlab.com/dak425/scripts/-/blob/master/trim_silenceV2
# https://youtu.be/ak52RXKfDw8
import math
import sys
import subprocess
import os
@vivekhaldar
vivekhaldar / church.js
Created Mar 4, 2016
Church numerals in ES6.
View church.js
//#!/usr/bin/env node --harmony
/*jshint esversion: 6 */
'use strict';
// Church numerals in ES6.
// c.f. https://en.wikipedia.org/wiki/Church_encoding
// Zero is the identity function.
let zero = (f => x => x);
@vivekhaldar
vivekhaldar / church.py
Created Apr 21, 2012
Church numerals in Python
View church.py
#! /usr/bin/python
#
# Church numerals in Python.
# See http://en.wikipedia.org/wiki/Church_encoding
#
# Vivek Haldar <vh@vivekhaldar.com>
#
# https://gist.github.com/2438498
zero = lambda f: lambda x: x
View gist:40113
#include <stdio.h>
int main(int argc, char **argv) {
printf("Hello world!");
return 0;
}