Skip to content

Instantly share code, notes, and snippets.

@patientzero
patientzero / splits.py
Last active February 22, 2023 09:04
Speaker exclusive splits used on the FluencyBank part of SEP-28k in the paper Detecting Dysfluencies in Stuttering Therapy Using wav2vec 2.0
# Sebastian P. Bayerl
FB_TEST = ['68m', '26m', '54m', '24fc', '34m', '24ma']
FB_DEV_SPK = ['46ma', '27f', '24fb', '37m', '29mc', '32m', '57m']
FB_TRAIN_SPK = ['24fa', '62m', '50fa', '29ma', '68m', '64m', '35ma', '27ma', '29mb', '28m', '26m',
'46mb', '43m', '54m', '26f', '60m', '35mb', '24fc', '34m', '62f', '24ma', '24mb',
'25m', '39f', '54f', '50fb']
FB_TRAIN_DEV = FB_TRAIN_SPK + FB_DEV_SPK
@patientzero
patientzero / load_cbt_annotations.py
Created December 15, 2021 14:22
loading wai labels
import pandas as pd
def load_cbt_annotations(path):
import json
with open(path) as f:
x = json.load(f)
# make session numeric
df = pd.DataFrame()
for k, v in x.items():
while v:
@patientzero
patientzero / morse_str_to_wav.py
Created November 11, 2021 19:53
morse code to wavefile implemented in python
def morse_code_to_wav(morse_str, sr=8000, short_burst_len=0.1, long_burst_len=0.2,
pause_len=0.05, frequency=500, output_file_name=None):
"""
@param morse_str: str containing . for short burst - for long burst and space for pause between words
@param sr: sampling frequency of the desired wav output
@param output_file_name: path to wavfile output
"""
amplitude = np.iinfo(np.int16).max * 0.7
t_pause = np.linspace(0, pause_len, int(sr * pause_len))
t_pause[:] = 0
@patientzero
patientzero / uninstall_vscode.sh
Created April 8, 2020 09:58
Uninstall Visual Studio Code from Mac
#!/bin/bash
# based on Medium Blogpost :https://medium.com/@jimkang/complete-uninstall-remove-vscode-mac-5e48bef3bdec
rm -rf $HOME/Library/Application\ Support/Code
rm -rf $HOME/.vscode
rm -rf /Applications/Visual\ Studio\ Code.app
@patientzero
patientzero / group_k_fold_example.py
Created October 10, 2019 14:48
Example for the usage of sklearn GroupKFold
from sklearn.model_selection import GroupKFold
# define number of splits
n_splits = 10
# all data in a list
pics = list(data_dir.glob('**/*.png'))
# matching labels in list
labels = [pic.parent.stem for pic in pics]
# get all groups that should not be in the
groups = [pic.stem.split('_')[1] for pic in pics]
gkf = GroupKFold(n_splits=n_splits)
@patientzero
patientzero / ffmpeg.md
Created August 27, 2019 08:33 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@patientzero
patientzero / cloudSettings
Last active December 21, 2020 11:42
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-12-21T11:42:03.823Z","extensionVersion":"v3.4.3"}
### Keybase proof
I hereby claim:
* I am patientzero on github.
* I am sebastianbayerl (https://keybase.io/sebastianbayerl) on keybase.
* I have a public key ASBAzeywZrXnBpjPs4rL5teZKmxbF8f7LP8G-xJHUr5WZQo
To claim this, I am signing this object:
@patientzero
patientzero / jira_letsencrypt.md
Created January 19, 2019 09:20 — forked from dborin/jira_letsencrypt.md
HOWTO Configure Atlassian Jira to use Letsencrypt certificate

HOWTO Configure Atlassian Jira to use Letsencrypt certificate with default Tomcat

This is a primer for installing a Letsencrypt certificate on a Jira server that is running the Jira provided, default Tomcat for serving webpages.

I found lots of information about how to do it using a free-standing Tomcat or nginx, but nothing about this particular combination. I hope it helps you!

Obviously, in all the examples, you need to replace jira.example.com with your own domain! And (duh) you need to use your own password, not 1234

You need to have installed Java (outside the scope of this document). Then in your user's shell RC file and probably root's RC file, add

@patientzero
patientzero / spectrograms.py
Last active November 22, 2018 13:04
Spectrograms
from scipy.io.wavfile import read,write
from pylab import plot,show,subplot,specgram
import pylab as pl
# Simple versions:
rate, data = read('wiederholung.wav')
_=specgram(data, NFFT=256, Fs=rate, noverlap=0,cmap='inferno',scale_by_freq=False) # small window
# Custom functions:
# Source : http://qaru.site/questions/804495/cutting-of-unused-frequencies-in-specgram-matplotlib