Skip to content

Instantly share code, notes, and snippets.

View RicherMans's full-sized avatar

Heinrich Dinkel RicherMans

View GitHub Profile
@RicherMans
RicherMans / v2ray_config.sh
Last active July 12, 2023 18:45
Simple ufw config for v2ray
ufw enable
ufw allow ssh
ufw allow 41335:60031/tcp # Or your v2ray kcp/udp port range
ufw allow 41335:60031/udp # Or your v2ray kcp/udp port range
ufw allow http
ufw allow https
ufw default deny incoming
ufw reload
import librosa
import scipy
import numpy as np
def cmc(y, sr, P=12, n_level=7, eps=1e-12, **kwargs):
log_abs_power_cqt = np.log(
np.abs(librosa.core.cqt(y=y, sr=sr, **kwargs))**2 + eps)
cmc_levels = []
for _ in range(n_level):
@RicherMans
RicherMans / lfcc.py
Created January 13, 2020 14:02
LFCC implementation in librosa
import numpy as np
import scipy
import matplotlib.pyplot as plt
import librosa
def lin(sr, n_fft, n_filter=128, fmin=0.0, fmax=None, dtype=np.float32):
if fmax is None:
fmax = float(sr) / 2
@RicherMans
RicherMans / download_audio.sh
Created January 9, 2020 02:22
download_audio.sh
# @Author: richman
# @Date: 2018-03-15
# @Last Modified by: richman
# @Last Modified time: 2018-03-30
if [[ $# < 1 ]]; then
echo "Input .csv file .e.g balanced_train_segments.csv"
exit
fi
@RicherMans
RicherMans / download_video_parallel.sh
Created January 6, 2020 06:57
download_video_parallel.sh
# @Author: richman
# @Date: 2018-03-15
# @Last Modified by: richman
# @Last Modified time: 2018-03-30
if [[ $# < 1 ]]; then
echo "Input .csv file .e.g balanced_train_segments.csv"
exit
fi
@RicherMans
RicherMans / MovingAvg.py
Last active December 26, 2019 02:46
Moving average similar to kaldis apply-cmvn-sliding in pytorch.
import torch
import torch.nn as nn
import torch.nn.functional as F
class MovingAvgNorm(nn.Module):
"""
Calculates multiple moving average estiamtes given a kernel_size
Similar to kaldi's apply-cmvn-sliding
"""
@RicherMans
RicherMans / read_hdf5.py
Created December 21, 2019 08:35
HDf5 test
import h5py
import numpy as np
from tqdm import tqdm
indices = list(range(100000))
rand_index = np.random.permutation(len(indices)).astype(str)
BATCH_SIZE = 128
def batch_gen():
@RicherMans
RicherMans / eval.py
Created December 4, 2019 04:47
Train and eval simple GMM for Spoofing using HDF5
from sklearn.mixture import GaussianMixture
import h5py
import fire
import numpy as np
import pandas as pd
from pypeln import thread as pr
from joblib import dump, load
from tqdm import tqdm
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.