Skip to content

Instantly share code, notes, and snippets.

View pthavarasa's full-sized avatar
🎯
Focused

Thavarasa Prasanth pthavarasa

🎯
Focused
View GitHub Profile
@pthavarasa
pthavarasa / process_rttm.py
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:
self.load(rttmLine)
else:
self.id = fileName.split(".")[0]
self.startTime = float(startTime)
self.duration = float(duration)
self.endTime = self.startTime + self.duration
self.speakerName = speakerName
@pthavarasa
pthavarasa / SpeakerSeparationStereoMono.py
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 scipy.io import wavfile
import librosa
import numpy as np
def splitStereo(stereoWav):
"0 : left channel, 1 : right channel"
sr, samples = wavfile.read(stereoWav)
@pthavarasa
pthavarasa / uploadMega.py
Created August 24, 2022 16:40
upload files to mega.nz 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)
self.mega.upload(path)
@pthavarasa
pthavarasa / mysqldump.php
Created August 19, 2022 17:59
Easy way to dump ( backup ) MySQL database with PHP script
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$user = 'wordpress';
$pass = 'password';
$host = 'localhost';