Skip to content

Instantly share code, notes, and snippets.

@bennylope
bennylope / todo.hs
Created October 11, 2015 15:57
Example #1: TODO program from Gabriel Gonzalez's Basic Haskell Examples
-- From http://www.haskellforall.com/2015/10/basic-haskell-examples.html
putTodo :: (Int, String) -> IO ()
putTodo (n, todo) = putStrLn (show n ++ ": " ++ todo)
prompt :: [String] -> IO ()
prompt todos = do
putStrLn ""
putStrLn "Current TODO list:"
mapM_ putTodo (zip [0..] todos)

Keybase proof

I hereby claim:

  • I am bennylope on github.
  • I am bennylope (https://keybase.io/bennylope) on keybase.
  • I have a public key whose fingerprint is 515A 85FE D3A7 9935 5E9E 2F6C CA23 6BC4 054B 7C47

To claim this, I am signing this object:

@bennylope
bennylope / todo.hs
Created December 10, 2015 19:20
Vaguely terrible Haskell
-- from http://www.haskellforall.com/2015/10/basic-haskell-examples.html
import System.Directory
import System.Environment
import System.IO
putTodo :: (Int, String) -> IO ()
putTodo (n, todo) = putStrLn (show n ++ ": " ++ todo)
prompt :: [String] -> IO ()
prompt todos = do
@bennylope
bennylope / envcopy.py
Last active December 18, 2015 15:23
Copy the contents of a Foreman compatible .env file to an envdir compatible configuration directory
#!/usr/bin/env python
"""
Script that copies contents of .env file to envdir compatible folder
:copyright: Ben Lopatin
:license: BSD
"""
import os
import sys
@bennylope
bennylope / config.py
Created December 17, 2015 15:32
Use Fabric to manage envdir compatible configuration data
"""
Remote environment variable configuration using envdir
This should be set up using a `fabfile/` module rather than
an individual `fabfile.py` file.
$ fab <env> config -- list environment variables (incl. values)
$ fab <env> config.set:DEBUG=False -- set a single variable
$ fab <env> config.set:DEBUG=False,SECRET=jdkjkjk -- set multiple variables
@bennylope
bennylope / leanpub.sh
Last active January 3, 2016 17:51
A Leanpub API client script
#!/usr/bin/env bash
# Copyright 2016, Ben Lopatin
# Licensed freely to use, modify, and redistribute under GNUGPLv3
APIKEY=$LEANPUB_API_KEY
SLUG=$LEANPUB_SLUG
case "$1" in
preview)
@bennylope
bennylope / export_issues.py
Created March 22, 2016 13:13
Export GitHub issues to a Pivotal Tracker-ready CSV format
#!/usr/bin/env python3
"""
Script for exporting GitHub Issues to an import ready CSV format.
Outputs to stdout for redirection.
It is hard coded (sorry) to include up to 2 comments from an issue.
Usage:
@bennylope
bennylope / ffmpeg-watermark.md
Created April 22, 2016 23:17 — forked from webkader/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.

@bennylope
bennylope / Vagrantfile
Created May 1, 2016 13:54 — forked from pansen/Vagrantfile
Jupyter (aka IPython Notebook) Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
@bennylope
bennylope / trim-movie.sh
Created May 24, 2016 22:38
A short helper script to decode QuickTime .mov files to mp4 files using default settings. Good for creating short screencasts.
#!/bin/bash
#
# A short helper script to decode QuickTime .mov files to mp4 files using default settings.
#
# Usage:
# ./trim-movie.sh path/to/source.mov path/to/destination.mp4
# ./trim-movie.sh path/to/source.mov path/to/destination.mp4 1080
#
# The optional third paramater is width. You may need to respecify this if you encounter
# divisibility by 2 errors. Not sufficiently motivated to bother checking the size and