Skip to content

Instantly share code, notes, and snippets.


Ben Lopatin bennylope

View GitHub Profile
bennylope / remotefiles.conf
Created Oct 19, 2011
nginx remote file proxying
View remotefiles.conf
location ~* ^/remote-files/(http[s]*://)(.*?)/(.*) {
# Do not allow people to mess with this location directly
# Only internal redirects are allowed
# nginx has to be able to resolve the remote URLs
# Location-specific logging
#access_log /usr/local/etc/nginx/logs/internal_redirect.access.log main;
bennylope /
Created Apr 22, 2016 — forked from webkader/
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.

bennylope / LICENSE
Last active Feb 10, 2021
Django file that loads environment variables from a .env file per Honcho/Foreman
Copyright the authors of Honcho and/or Ben Lopatin
Licensed for reuse, modification, and distribution under the terms of the MIT license
bennylope / gist:1894706
Created Feb 23, 2012
Canonical URLs with Jekyll
View gist:1894706
<link rel="canonical" href="{{ page.url | replace:'index.html','' }}" />
from functools import wraps
def annotated(annotation_name):
Decorator for returning pre-calculated, annotated values
This should be used with model instance methods that fetch some
kind of related or calculated data. If the method is called on
a single instance in isolation, we should expect the method to
bennylope / ansible.yml
Created Apr 30, 2014
Deployment w/ Capistrano style deployments with Ansible & Capistrano
View ansible.yml
- name: Deploy new site release
user: deployer
hosts: all
- name: Fetch repo updates
git: >
bennylope /
Last active Aug 20, 2020
Create a named database and restore from the lastest downloaded file
#!/usr/bin/env bash
LATEST_DB="$HOME/Downloads/$(ls -t ~/Downloads | head -1)"
echo "Creating database name $DB from $BACKUP_PATH"
import requests
class RemoteFile:
Context manager for handling remote OR local files
Can be used like so:
>>> with RemoteFile("/path/to/local/file.txt") as f:
bennylope / console.js
Created May 27, 2020
Download your Papertrail gzipped archives
View console.js
Copy and paste into your browser console window after loading
your archives page, e.g. with a selected long date range.
The problem I had with my first attempt was that there was no delay,
so I was only downloading the last entry on the page. The linked
solution above pointed to the problem (each subsequent request was
killing the preceding request) which was including a delay. Here
bennylope /
Created Feb 28, 2020
Common (?) pattern for consuming paged objects as a stream in Python, using Stripe Subscriptions as an example
import functools
import stripe
from typing import Any, Optional
def stripe_subscriptions(limit: Optional[int] = 100, **params: Any):
Returns an iterator of all matching subscriptions