Skip to content

Instantly share code, notes, and snippets.

@jameslyons
jameslyons / create_currennt_HDF5.m
Created Oct 23, 2015
create HDF5 file for currennt
View create_currennt_HDF5.m
close all;
clear all;
% load the protein dataset, this is a array of struct that has fields .pssm and .ss
% which are our features and labels respectively. pssm is a L by 20 array of features.
% ss is a L by 1 array of characters C, E, H or X which are our 4 classes.
% the actual variable that appears is called 'combined'
load protein_dataset;
% this is the name of the HDF5 file we will be writing to
fname = ['proteins_train_currennt.nc'];
@jameslyons
jameslyons / iris_caffe_solver.prototxt
Created Aug 20, 2015
caffe solver for iris dataset
View iris_caffe_solver.prototxt
# The train/test net protocol buffer definition
net: "./iris_caffe_network.prototxt"
# test_iter specifies how many forward passes the test should carry out.
# In the case of iris, we have test batch size 10 (specified in iris_network.prototxt)
# and 5 test iterations covering the full 50 test vectors.
test_iter: 5
# Carry out testing every 500 training iterations.
test_interval: 100
# The base learning rate, momentum and the weight decay of the network.
base_lr: 0.001
@jameslyons
jameslyons / iris_caffe_network.prototxt
Last active Aug 29, 2015
caffe network specification for single layer FF MLP on iris dataset.
View iris_caffe_network.prototxt
name: "iris"
layer {
name: "data"
type: "HDF5Data"
top: "data"
top: "label"
include: {
phase: TRAIN
}
hdf5_data_param {
@jameslyons
jameslyons / create_iris_hdf5_files.m
Created Aug 20, 2015
matlab script for generating hdf5 data files for caffe
View create_iris_hdf5_files.m
% load the dataset, this is built in to matlab
load fisheriris
% the data is ordered, we want to randomly select 100 points for train, 50
% for test. This part just generates a random list of array indices.
indices = randperm(150);
train_indices = indices(1:100);
test_indices = indices(101:end);
% meas contains the features, we use our random indices to select a subset
@jameslyons
jameslyons / f2routes.txt
Created Dec 18, 2014
second feynman cipher 40 routes
View f2routes.txt
XUKEXWSLZJUAXUNKIGWFSOZRAWURORKXAOSLHROBXBTKCMUWDVPTFBLMKEFVWMUXTVTWUIDDJVZKBRMCWOIWYDXMLUFPVSHAGSVWUFWORCWUIDUJCNVTTBERTUNOJUZHVTWKORSVRZSVVFSQXOCMUWPYTRLGBMCYPOJCLRIYTVFCCMUWUFPOXCNMCIWMSKPXEDLYIQKDJWIWCJUMVRCJUMVRKXWURKPSEEIWZVXULEIOETOOFWKBIUXPXUGOWLFPWUSCH
XRFMTOUWLUKVLBCWCEKXWUEMUJIEAMFRUFUOXOUPTWPMEWSXVUPOVTSLTSNYXROLHVHOTCCOZRTAJRNJFJOWGULMUWUBUSZGCMKAXIVHBIVBXBDWVMWRIUTDUTCMKUNKJFWYSXXKCVWKPKWPIMZOOOPUXGUKRRJXRUWWBCSCEKGFDRWVLDPOSVMURRLSWOPCIZIYELZTWDSYIEFRFOUVTQIPABIJVVKWWWLWCFFDZUUMYNSCJVSRKDVQCWXCOEXTXMIUH
HCSUWPFLWOGUXPXUIBKWFOOTEOIELUXVZWIEESPKRUWXKRVMUJCRVMUJCWIWJDKQIYLDEXPKSMWICMNCXOPFUWUMCCFVTYIRLCJOPYCMBGLRTYPWUMCOXQSFVVSZRVSROKWTVHZUJONUTREBTTVNCJUDIUWCROWFUWVSGAHSVPFULMXDYWIOWCMRBKZVJDDIUWTVTXUMWVFEKMLBFTPVDWUMCKTBXBORHLSOAXKRORUWARZOSFWGIKNUXAUJZLSWXEKUX
HUIMXTXEOCXWCQVDKRSVJCSNYMUUZDFFCWLWWWKVVJIBAPIQTVUOFRFEIYSDWTZLEYIZICPOWSLRRUMVSOPDLVWRDFGKECSCBWWURXJRRKUGXUPOOOZMIPWKPKWVCKXXSYWFJKNUKMCTUDTUIRWMVWDBXBVIBHVIXAKMCGZSUBUWUMLUGWOJFJNRJATRZOCCTOHVHLORXYNSTLSTVOPUVXSWEMPWTPUOXOUFURFMAEIJUM
@jameslyons
jameslyons / pdb2fasta.py
Last active Jan 4, 2020
convert pdb file to fasta
View pdb2fasta.py
import sys
if len(sys.argv) <= 1:
print 'usage: python pdb2fasta.py file.pdb > file.fasta'
exit()
input_file = open(sys.argv[1])
letters = {'ALA':'A','ARG':'R','ASN':'N','ASP':'D','CYS':'C','GLU':'E','GLN':'Q','GLY':'G','HIS':'H',
'ILE':'I','LEU':'L','LYS':'K','MET':'M','PHE':'F','PRO':'P','SER':'S','THR':'T','TRP':'W',
@jameslyons
jameslyons / spectral_subtraction_demo.m
Created Dec 1, 2014
spectral subtraction demo in matlab
View spectral_subtraction_demo.m
[sig fs] = read_NIST_file(filename); % read the input file, assume filename is supplied
NFFT = 1024;
WINLEN = 0.025; %frame length in ms
WINSTEP = 0.01;
frames = frame_sig(sig, WINLEN*fs, WINSTEP*fs, @hamming);
cspec = fft(frames,NFFT,2); % complex spectrum
pspec = abs(cspec).^2; % power spectrum of noisy signal
phase = angle(cspec);
% do spectral subtraction, produce modified_pspec
@jameslyons
jameslyons / add_noise_to_NIST_files.m
Last active Aug 29, 2015
add_noise_to_NIST_files.m
View add_noise_to_NIST_files.m
SNR=40; % the SNR of white noise to apply to each file
path = '/home/james/databases/speech_db/timit_xxl_white/db/timit_full';
[status,result]=system(['find ',path,' -name "*.wav" | grep -v snr > ',path,'/timit_list.txt']);
listfilename = [path,'/timit_list.txt'];
filelist = fopen(listfilename);
wavname = fgetl(filelist);
count = 1;
while ischar(wavname),
@jameslyons
jameslyons / delastelle.py
Created Feb 10, 2014
delastelle cipher in python
View delastelle.py
from itertools import product
key = "EPSDUCVWYM ZLKXNBTFGORIJHAQ"
IND2L = dict(zip(list(product((1,2,3),repeat=3)),key))
L2IND = dict(zip(key,list(product((1,2,3),repeat=3))))
ptext = 'DEFEND THE EAST WALL OF THE CASTLE'
ctext = ""
for c in ptext:
@jameslyons
jameslyons / arburg.jl
Created Feb 10, 2014
burg method of LPC computation
View arburg.jl
function arburg(x,p)
N = length(x)
P = zeros(1,p+1)
f = zeros(p+1,N)
b = zeros(p+1,N)
a = zeros(p,p)
# Initialisation
f[1,:] = x