Skip to content

Instantly share code, notes, and snippets.

@moeseth
moeseth / calculate_myanmar_pawn_months.php
Created January 3, 2017 03:31
A php function to calculate pawn months in Myanmar
<?php
function calculate_pawn_months($start_date, $end_date)
{
$start_date = new DateTime($start_date);
$end_date = new DateTime($end_date);
$diff_months = ($start_date->diff($end_date)->m + ($start_date->diff($end_date)->y * 12));
$total_days = $start_date->diff($end_date)->d;
@moeseth
moeseth / waveform.py
Created October 12, 2015 08:19
Create Soundcloud style waveform from Audio in Python
from pydub import AudioSegment
from matplotlib import pyplot as plot
from PIL import Image, ImageDraw
import numpy as np
import os
src = "./test.mp3"
audio = AudioSegment.from_file(src)
data = np.fromstring(audio._data, np.int16)