Skip to content

Instantly share code, notes, and snippets.

@danrossi
danrossi / stripe_webhook.py
Created May 4, 2021
Stripe Checkout Webhook Lambda Function
View stripe_webhook.py
# 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 / flac2wav.py
Last active Dec 16, 2018
Flac2Wav - Converter and preparation script for Rekordbox and Pioneer CDJ players that don't support Flac.
View flac2wav.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pip install sox
import json
from multiprocessing import Pool
import logging
import os
@danrossi
danrossi / PersistDrmKeySetIdManager.java
Created Dec 2, 2016
ExoPlayer 2 Offline DRM persistence
View PersistDrmKeySetIdManager.java
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 / gist:806b39fa13d8ebbca2fc46ab9bd5f854
Created Apr 23, 2016
Lets Encrypt Renew Script For Cloudfront
View gist:806b39fa13d8ebbca2fc46ab9bd5f854
#!/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 / gist:9671af71f1c4e6d429658b5231ae6634
Created Apr 23, 2016
Lets Encrypt Install Script For Cloudfront
View gist:9671af71f1c4e6d429658b5231ae6634
#!/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:ee15e1ba84ba8b203bb18fba5cb876fb
Created Apr 23, 2016
Lets Encrypt Renew Script For Nginx
View gist:ee15e1ba84ba8b203bb18fba5cb876fb
#!/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:11126172
Created Apr 20, 2014
Metasploit Install For OSX
View gist:11126172
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 / mediafilesegmenter.sh
Created May 9, 2013
This script generates HLS streaming files with variant playlist and alternate audio. Uses mediafilesegmenter and variantplaylistcreator
View mediafilesegmenter.sh
#!/bin/sh
usage()
{
cat << EOF
usage: $0 options
This script generates HLs streaming files with variant playlist and alternate audio.
OPTIONS:
@danrossi
danrossi / wav2png.sh
Last active Dec 17, 2015
Convert video audio to waveform image. Requires wav2png https://github.com/beschulz/wav2png and ffmpeg.
View wav2png.sh
#!/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"