Skip to content

Instantly share code, notes, and snippets.

View pthavarasa's full-sized avatar

Thavarasa Prasanth pthavarasa

View GitHub Profile
pthavarasa /
Last active September 16, 2022 16:22
load rttm format file to process easily (RTTM format used for speaker diarization system output and reference files)
class LabelRTTM():
def __init__(self, fileName=None, startTime=None, duration=None, speakerName=None, rttmLine=None):
if rttmLine:
else: = fileName.split(".")[0]
self.startTime = float(startTime)
self.duration = float(duration)
self.endTime = self.startTime + self.duration
self.speakerName = speakerName
pthavarasa /
Last active September 26, 2022 16:54
splitting wav audio stereo to mono and perform voice activity detector with webrtcvad. export spaker label as rttm format file
# pip install webrtcvad
# pip install noisereduce
from import wavfile
import librosa
import numpy as np
def splitStereo(stereoWav):
"0 : left channel, 1 : right channel"
sr, samples =
pthavarasa /
Created August 24, 2022 16:40
upload files to using python (single file, directory, by extension)
from mega import Mega
import os
class UploadMega():
def __init__(self, id, password):
mega = Mega()
self.mega = mega.login(id, password)
def upload_single_file(self, path):
print("uploading :", path)
pthavarasa / mysqldump.php
Created August 19, 2022 17:59
Easy way to dump ( backup ) MySQL database with PHP script
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
$user = 'wordpress';
$pass = 'password';
$host = 'localhost';