Skip to content

Instantly share code, notes, and snippets.

@hzlmn
hzlmn / ffmpeg-watermark.md
Created February 24, 2021 08:07 — 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.

@hzlmn
hzlmn / testcase_assert_not_raises.py
Created October 23, 2018 10:11
Python unittest: Testing an exception is not raised
import unittest
from contextlib import contextmanager
class TestCase(unittes.TestCase):
@contextmanager
def assertNotRaises(self, exc_type):
try:
yield None
@hzlmn
hzlmn / CouchDB_Python.md
Created July 6, 2018 09:49 — forked from marians/CouchDB_Python.md
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@hzlmn
hzlmn / Java.md
Created July 5, 2018 09:46 — forked from JeOam/Java.md
Install Java 8 on OS X

on El Capitan, after installing the brew...

$ brew update
$ brew tap caskroom/cask
$ brew install Caskroom/cask/java

And Java 8 will be installed at /Library/Java/JavaVirtualMachines/jdk1.8.xxx.jdk/

Check version:

@hzlmn
hzlmn / aiohttp_injections.py
Created May 30, 2018 13:54 — forked from jettify/aiohttp_injections.py
aiohttp dependency injection example
import asyncio
import injections
import aiopg.sa
from aiohttp import web
@injections.has
class SiteHandler:
# this is only place holder, actual connection
@hzlmn
hzlmn / books.md
Created October 8, 2017 19:32 — forked from alastairparagas/books.md
High quality and highly recommended programming books and topics. This list will be updated frequently. Books for each programming language are arranged from beginner to expert-level difficulty.

Javascript

Javascript is a programming language that started out being the main language to "code" the web. It is used to build web apps and websites alongside HTML and CSS. However, it can now also be used to build server-side, desktop and hybrid mobile apps. Heck, it can even be used to program Arduino microcontroller boards!

  • Eloquent Javascript by Marijn Haverbeke
  • Javascript: The Good Parts by Douglas Crockford
  • The Principles of Object Oriented Javascript by Nicholas Zakas
  • Programming Javascript Applications by Eric Elliot
  • Speaking Javascript by Axel Rauschmayer
  • Javascript Enlightenment by Code Lindley
  • You Don't Know JS (series) by Kyle Simpson
@hzlmn
hzlmn / latency.txt
Created August 4, 2017 11:48 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@hzlmn
hzlmn / class_decorator.ts
Created April 6, 2017 17:44 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@hzlmn
hzlmn / class_decorator.ts
Created April 6, 2017 17:44 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@hzlmn
hzlmn / The Technical Interview Cheat Sheet.md
Created February 19, 2016 12:31 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.