Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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.