Skip to content

Instantly share code, notes, and snippets.

@danrossi
danrossi / wav2png.sh
Last active December 17, 2015 03:59
Convert video audio to waveform image. Requires wav2png https://github.com/beschulz/wav2png and ffmpeg.
#!/bin/sh
SRC_INPUT=$1
OUT_FILENAME=$2
TMP_DIR=/tmp
SRC_FILENAME=`basename ${SRC_INPUT}`
ffmpeg -i "$SRC_INPUT" -acodec pcm_s16le -ac 2 "${TMP_DIR}/${SRC_FILENAME}.wav"
@danrossi
danrossi / mediafilesegmenter.sh
Created May 9, 2013 12:27
This script generates HLS streaming files with variant playlist and alternate audio. Uses mediafilesegmenter and variantplaylistcreator
#!/bin/sh
usage()
{
cat << EOF
usage: $0 options
This script generates HLs streaming files with variant playlist and alternate audio.
OPTIONS:
@danrossi
danrossi / gist:11126172
Created April 20, 2014 21:51
Metasploit Install For OSX
export PATH=/opt/local/bin:/opt/local/msf3:/opt/local/lib/postgresql84/bin:$PATH
# download ruby and postgresql. postgres of mysql is required it wont work with sqlite ?
sudo port install ruby19 +nosuffix postgresql84-server
# install pg gem
sudo gem install pg
# select default ruby
sudo port select --set ruby ruby19
# download metasploit framework sources
wget http://downloads.metasploit.com/data/releases/framework-latest.tar.bz2 -O - | tar -xj
@danrossi
danrossi / gist:ee15e1ba84ba8b203bb18fba5cb876fb
Created April 23, 2016 02:01
Lets Encrypt Renew Script For Nginx
#!/bin/sh
service nginx stop # or whatever your webserver is
letsencrypt renew -nvv --standalone > /var/log/letsencrypt/renew.log 2>&1
LE_STATUS=$?
service nginx start # or whatever your webserver is
if [ "$LE_STATUS" != 0 ]; then
echo Automated renewal failed:
cat /var/log/letsencrypt/renew.log
exit 1
fi
@danrossi
danrossi / gist:9671af71f1c4e6d429658b5231ae6634
Created April 23, 2016 02:06
Lets Encrypt Install Script For Cloudfront
#!/bin/sh
AWS_ACCESS_KEY_ID="key" \
AWS_SECRET_ACCESS_KEY="key" \
letsencrypt \
--agree-tos -a letsencrypt-s3front:auth \
--letsencrypt-s3front:auth-s3-bucket bucket-name \
--letsencrypt-s3front:auth-s3-region bucket-region \
-i letsencrypt-s3front:installer \
--letsencrypt-s3front:installer-cf-distribution-id cloudfront-dist-id \
@danrossi
danrossi / gist:806b39fa13d8ebbca2fc46ab9bd5f854
Created April 23, 2016 02:08
Lets Encrypt Renew Script For Cloudfront
#!/bin/sh
AWS_ACCESS_KEY_ID="key" \
AWS_SECRET_ACCESS_KEY="key" \
letsencrypt \
--renew-by-default --text \
--agree-tos -a letsencrypt-s3front:auth \
--letsencrypt-s3front:auth-s3-bucket bucket-name \
--letsencrypt-s3front:auth-s3-region bucket-region \
-i letsencrypt-s3front:installer \
@danrossi
danrossi / PersistDrmKeySetIdManager.java
Created December 2, 2016 13:35
ExoPlayer 2 Offline DRM persistence
package org.electroteque.widevine.drm;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Base64;
public class PersistDrmKeySetIdManager {
private SharedPreferences settings;
@danrossi
danrossi / flac2wav.py
Last active November 8, 2023 10:41
Flac2Wav - Converter and preparation script for Rekordbox and Pioneer CDJ players that don't support Flac.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pip install sox
import json
from multiprocessing import Pool
import logging
import os
@danrossi
danrossi / stripe_webhook.py
Created May 4, 2021 12:55
Stripe Checkout Webhook Lambda Function
# Stripe Checkout Webhook Lambda Function
# Updates customer with missing name and address
# Sends custom SES email with product, price and any metadata field required
# Possible to send custom post payment invoice
# @author Daniel Rossi
import stripe
import boto3
import json
import os
@danrossi
danrossi / VideoAnimation
Created July 8, 2021 15:58
requestVideoFrameCallback with legacy mode to requestAnimationFrame
const supportsFrameCallback = 'requestVideoFrameCallback' in HTMLVideoElement.prototype,
requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame,
cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
export default class VideoAnimation {
constructor(callback, video) {
this.callback = callback,
this.video = video,
this.animationID = null,