Skip to content

Instantly share code, notes, and snippets.

### re-Encoding
# re-encode video, using x265 HEVC Encoding, LAME mp3 encoding (48K CBR)
ffmpeg -i in.mp4 -vcodec libx265 -acodec libmp3lame -b:a 48k out.mp4
### Clipping out a part of the video...
# 60 second clip starting 90 seconds in (stream copy)
ffmpeg -ss 90 -i orig.mp4 -t 60 -c copy out.mp4
@homingli
homingli / gremlind.yml
Created September 21, 2018 03:54
example docker compose yaml for starting gremlin daemon
version: '3'
services:
gremlin:
image: gremlin/gremlin
command: daemon
network_mode: "host"
pid: "host"
cap_add:
- NET_ADMIN
- SYS_ADMIN
@homingli
homingli / app.dockerfile
Created December 18, 2017 22:39
Example Flask Container with X-Ray
FROM python:3-alpine
RUN pip3 install boto3 flask aws_xray_sdk
COPY app.py /
ENTRYPOINT [ "python", "/app.py" ]
EXPOSE 5000
package main
import (
"flag"
"fmt"
"strings"
"log"
"os"
"time"
"encoding/json"
@homingli
homingli / chaosfcn.py
Created January 14, 2017 00:54
Simple Opt-In Chaos Function
# choasfcn (python 2.7)
# purpose: test resiliency of the EC2 environment (opt-in with tag)
# implementation:
# 0) leverage CW Events to schedule trigger this function
# 1) retrieves list of instances that is participating
# 2) terminates a random sample of the participating instances
# TODO
# error handling
# no safe guard (ex. deleting all instances related to the same application)
@homingli
homingli / README.md
Last active August 29, 2015 14:18
simple node.js server that prints hostname and instance-id, with custom response time

Notes

Defaults:

1s response

port 3000

Usage

@homingli
homingli / curlt
Created August 28, 2013 22:04
curlt (timing wrapper for curl) - from https://github.com/mat/dotfiles/blob/master/bin/curlt
#!/bin/bash
#
# curl wrapper returning timing information.
#
# curl format adapted from
# http://josephscott.org/archives/2011/10/timing-details-with-curl/
#
# Example usage:
# $ curlt http://www.apple.com
# $ time curlt http://www.apple.com -v
@homingli
homingli / autoscale-on-cpu.py
Created July 31, 2013 19:09
Python scripts used in ActiveState webinar "Advanced Scaling Techniques with PaaS"
from stackato.interfaces import StackatoInterface
from bs4 import BeautifulSoup
import requests
import yaml
CREDENTIALS = yaml.load(open('credentials.yml'))
APP_NAME = 'your-app-name'
NEW_RELIC_USER_ID = 'your-user-id'
NEW_RELIC_APPLICATION_ID = 'your-app-id'
@homingli
homingli / config
Created July 12, 2013 00:06
Terminator config on Ubuntu for solarize color scheme.
[global_config]
[keybindings]
[profiles]
[[default]]
scrollback_lines = 9999
# solarized-dark
palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#002b36:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
foreground_color = "#eee8d5"
background_color = "#002b36"
cursor_color = "#eee8d5"
#!/usr/bin/env bash
function convert_file {
infile=$1
outfile=`echo $infile | sed 's/\.md$/\.html/'`
echo "Converting $infile to $outfile... "
cat > $outfile <<EOF
<!DOCTYPE html>
<html>
<head>