Skip to content

Instantly share code, notes, and snippets.

View SuperShinyEyes's full-sized avatar

Seyoung Park SuperShinyEyes

View GitHub Profile
class EasyDict(dict):
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)
def __getattr__(self, name): return self[name]
def __setattr__(self, name, value): self[name] = value
def __delattr__(self, name): del self[name]
import numpy as np
from scipy import constants
def fibonacci(n):
"""Calculate fibonacci system in signal processing way; weighted sum of fundamental modes.
The complexity: O(1).
"""
p = constants.golden
return int(np.around(
def shelving(ys, cut_off, gain, mode='low'):
'''Shelving filter for bass
Args:
ys (numpy.array): 1D signals
cut_off (float): Normalized cut-off frequency. 0 < cut_off < 1
gain (float): gain in dB
'''
gain = 10 ** (gain / 20) # NOTE: is it 20 or 40?
wc = 2 * np.pi * cut_off / 44100 # cut_off frequency in radians(0 <= wc <= pi)
#----------------------------------------------------------
# Remove local uncommited changes
# https://docs.gitlab.com/ee/topics/git/numerous_undo_possibilities_in_git/
git reset --hard
#----------------------------------------------------------
# Fetch
# https://www.atlassian.com/git/tutorials/syncing/git-fetch
git fetch origin master
@SuperShinyEyes
SuperShinyEyes / conda.yml
Created January 17, 2019 22:36
how-bots-type environment
name: how-bots-type
channels:
- pytorch
- defaults
dependencies:
- click=7.0
- ffmpeg=4.0
- ipython=7.2
- jupyterlab=0.35
- matplotlib=3.0
@SuperShinyEyes
SuperShinyEyes / Dockerfile
Created December 23, 2018 05:28
PerceptualSimilarity
FROM nvidia/cuda:9.0-base-ubuntu16.04
LABEL maintainer="Seyoung Park <seyoung.arts.park@protonmail.com>"
# This Dockerfile is forked from Tensorflow Dockerfile
# Pick up some PyTorch gpu dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cuda-command-line-tools-9-0 \
import tensorflow as tf
from time import time
start = time()
mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
import matplotlib.pyplot as plt
import soundfile as sf
import librosa
plt.rcParams['font.family'] = 'serif'
plt.rcParams['font.serif'] = 'Ubuntu'
plt.rcParams['font.monospace'] = 'Ubuntu Mono'
plt.rcParams['font.size'] = 10
plt.rcParams['axes.labelsize'] = 10 # Time and Hz, i.e. labels
plt.rcParams['axes.labelweight'] = 'bold'
import matplotlib.pyplot as plt
import soundfile as sf
import librosa
import librosa.display
plt.rcParams['font.family'] = 'serif'
plt.rcParams['font.serif'] = 'Ubuntu'
plt.rcParams['font.monospace'] = 'Ubuntu Mono'
plt.rcParams['font.size'] = 10
plt.rcParams['axes.labelsize'] = 10 # Time and Hz, i.e. labels
@SuperShinyEyes
SuperShinyEyes / gmail_imap_example.py
Created November 7, 2018 12:31 — forked from robulouski/gmail_imap_example.py
Very basic example of using Python and IMAP to iterate over emails in a gmail folder/label. http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#!/usr/bin/env python
#
# Very basic example of using Python and IMAP to iterate over emails in a
# gmail folder/label. This code is released into the public domain.
#
# RKI July 2013
# http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#
import sys
import imaplib