Skip to content

Instantly share code, notes, and snippets.

@lrytz
lrytz / z-automator.png
Last active February 4, 2023 21:20
Shortcut for Syntax Highlighting in Keynote
@kastnerkyle
kastnerkyle / extract_feats.py
Last active December 12, 2022 21:27
Extract features with HTK/speech_tools/festival/merlin
from __future__ import print_function
import os
import shutil
import stat
import subprocess
import time
import numpy as np
from scipy.io import wavfile
import re
import glob
@twiecki
twiecki / bayesian_neural_network.ipynb
Last active February 22, 2022 01:28
Bayesian Neural Network in PyMC3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kastnerkyle
kastnerkyle / install_tts.py
Last active December 1, 2021 17:27
Install speech toolkit and create features
from __future__ import print_function
import subprocess
import shutil
import os
import stat
import time
# This script looks extremely defensive, but *should* let you rerun at
# any stage along the way. Also a lot of code repetition due to eventual support
# for "non-blob" install from something besides the magic kk_all_deps.tar.gz
@keunwoochoi
keunwoochoi / spectrogram_scrolling_video.sh
Created July 18, 2019 23:09
Generate a video with scrolling over the spectrogram of the input audio.
# This is a simplified script of https://gist.github.com/keunwoochoi/f0ea2c49355fc21e93dad88d210efcdd
# Usage: 1. Modify the font path in the line with [ss].
# In my case, I copied and pasted CircularSpAraTTBlack.ttf to the same folder.
# 2. Put the wav file in the same folder, say, audio_file.wav
# 3. run $./spectrogram_scrolling_video.sh audio_file.wav
# 4. You'll see audio_file.mkv in the same folder!
#
# Based on example here https://trac.ffmpeg.org/wiki/Encode/YouTube
text=$(basename $1 .wav)
ffmpeg -i $1 -filter_complex \
@kastnerkyle
kastnerkyle / optimizers.py
Last active January 12, 2021 13:46
Theano optimizers
# Authors: Kyle Kastner
# License: BSD 3-clause
import theano.tensor as T
import numpy as np
import theano
class rmsprop(object):
"""
RMSProp with nesterov momentum and gradient rescaling
@panisson
panisson / ncp.py
Last active June 9, 2020 01:44
Nonnegative Tensor Factorization, based on the Matlab source code available at Jingu Kim's home page: https://sites.google.com/site/jingukim/home#ntfcode Requires the installation of Numpy and Scikit-Tensor (https://github.com/mnick/scikit-tensor). For examples, see main() function.
# Copyright (C) 2013 Istituto per l'Interscambio Scientifico I.S.I.
# You can contact us by email (isi@isi.it) or write to:
# ISI Foundation, Via Alassio 11/c, 10126 Torino, Italy.
#
# This work is licensed under a Creative Commons 4.0
# Attribution-NonCommercial-ShareAlike License
# You may obtain a copy of the License at
# http://creativecommons.org/licenses/by-nc-sa/4.0/
#
# This program was written by Andre Panisson <panisson@gmail.com> at
import pyeliza
class Eliza:
aliases = 'eliza'
description = 'Virtual therapist'
_therapist = pyeliza.eliza()
def execute(self, expression, context):
'''
>>> from mock import Mock
@brainstorm
brainstorm / fix_osx_pcbnew_kicad_libs.sh
Created September 1, 2017 16:24
Fix KiCAD's pcbnew python scripting support for OSX
#!/bin/bash
# Inspired on: https://www.bountysource.com/issues/31269729-libwx_osx_cocoau-3-1-dylib-not-found
KICAD_LIBS_TOFIX="libwx_osx_cocoau_gl-3.0.0 libwx_osx_cocoau_adv-3.0.0 libwx_osx_cocoau_aui-3.0.0 libwx_osx_cocoau_adv-3.0.0 libwx_osx_cocoau_html-3.0.0 libwx_osx_cocoau_core-3.0.0 libwx_osx_cocoau_stc-3.0.0 libkicad_3dsg.2.0.0 libGLEW.2.0.0 libcairo.2 libpixman-1.0 libwx_baseu_net-3.0.0 libwx_baseu-3.0.0 libwx_baseu_xml-3.0.0"
#KICAD_LIBS_TOFIX=`find /Applications/Kicad/kicad.app/Contents/Frameworks/ -iname *.dylib | xargs otool -L | grep executable_path | awk '{print $1}' | awk -F'/' '{print $4}'`
for kicadlib in $KICAD_LIBS_TOFIX;
do
echo "Fixing ${kicadlib} broken path on pcbnew..."
import theano
import theano.tensor as T
import numpy as np
import cPickle
import random
import matplotlib.pyplot as plt
class RNN(object):
def __init__(self, nin, n_hidden, nout):