Skip to content

Instantly share code, notes, and snippets.

View RicherMans's full-sized avatar

Heinrich Dinkel RicherMans

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RicherMans
RicherMans / sampler.py
Last active November 5, 2019 09:21
Minimum Occupancy Sampler for SED
import torch
import torch.utils.data as dset
import torch
import random
import sklearn.datasets as skl
import numpy as np
import itertools
class MinimumOccupancySampler(dset.Sampler):
@RicherMans
RicherMans / debloat.sh
Last active November 4, 2019 14:12
Xiaomi Debloat
# Apps
pm uninstall -k --user 0 com.android.email
pm uninstall -k --user 0 com.android.browser
pm uninstall -k --user 0 com.duokan.reader
pm uninstall -k --user 0 com.xiaomi.gamecenter
pm uninstall -k --user 0 com.miui.player
pm uninstall -k --user 0 com.android.email
#Other
pm uninstall -k --user 0 com.xiaomi.channel
pm uninstall -k --user 0 com.xiaomi.joyose
@RicherMans
RicherMans / v2ray.sh
Created August 28, 2019 05:14
V2ray centos6 init script, taken from #101 in v2ray-core
#!/bin/sh
#
# v2ray Startup script for v2ray
#
# chkconfig: - 24 76
# processname: v2ray
# pidfile: /var/run/v2ray.pid
# description: V2Ray proxy services
#
@RicherMans
RicherMans / interwaeave.py
Last active June 12, 2019 08:15
Interwaves two arrays given a specific ratio of array1 to array2, Ratio can also be float
def interweave(ratio, arr1, arr2):
combined_length = len(arr1) + len(arr2)
index_array = np.arange(combined_length)
take_array = (ratio * np.arange(0, len(arr1))).round().astype(int)
take_binary = np.zeros_like(index_array).astype(bool)
take_binary[take_array] = 1
index_array[take_binary] = arr1
index_array[~take_binary] = arr2
return index_array
@RicherMans
RicherMans / plt_avec.py
Created May 30, 2019 08:31
Plots distribution of scores for AVEC2017
import numpy as np
import pandas as pd
from fire import Fire
import plotnine as p
def plot(inputfile: str):
"""Plots using plotnine Test or dev destirbution of labels
:inputfile: str: TODO
@RicherMans
RicherMans / pretrained_resnet3d.py
Created April 17, 2019 11:08
Pretrained Resnet used for SED
class PretrainedResNet(torch.nn.Module):
"""Docstring for PretrainedResNet. """
def __init__(self, outputdim):
"""TODO: to be defined1.
:outputdim: TODO
"""
@RicherMans
RicherMans / extract_audio_video.sh
Last active April 17, 2019 06:24
Split video file into audio / video indep. components
#!/usr/bin/env bash
if [[ $# -lt 2 ]]; then
echo "Input Flist and Output dir"
exit
fi
module load parallel
module load ffmpeg
@RicherMans
RicherMans / audio_video.py
Last active April 11, 2019 05:56
Audio_video extract
import numpy as np
import pandas as pd
import os
import argparse
from mimetypes import MimeTypes
import librosa
import deepdish as dd
from tqdm import tqdm
parser = argparse.ArgumentParser()
import pandas as pd
import os
from plotnine import *
import numpy as np
from fire import Fire
from mistletoe import Document, HTMLRenderer
def plot(report_md: str = 'report.md'):
"""Plots the report ( all markdown tables )