Skip to content

Instantly share code, notes, and snippets.

@jameslyons
jameslyons / create_currennt_HDF5.m
Created October 23, 2015 05:00
create HDF5 file for currennt
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 August 20, 2015 07:53
caffe solver for iris dataset
# 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 August 29, 2015 14:27
caffe network specification for single layer FF MLP on iris dataset.
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 August 20, 2015 07:16
matlab script for generating hdf5 data files for caffe
% 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 December 18, 2014 09:45
second feynman cipher 40 routes
XUKEXWSLZJUAXUNKIGWFSOZRAWURORKXAOSLHROBXBTKCMUWDVPTFBLMKEFVWMUXTVTWUIDDJVZKBRMCWOIWYDXMLUFPVSHAGSVWUFWORCWUIDUJCNVTTBERTUNOJUZHVTWKORSVRZSVVFSQXOCMUWPYTRLGBMCYPOJCLRIYTVFCCMUWUFPOXCNMCIWMSKPXEDLYIQKDJWIWCJUMVRCJUMVRKXWURKPSEEIWZVXULEIOETOOFWKBIUXPXUGOWLFPWUSCH
XRFMTOUWLUKVLBCWCEKXWUEMUJIEAMFRUFUOXOUPTWPMEWSXVUPOVTSLTSNYXROLHVHOTCCOZRTAJRNJFJOWGULMUWUBUSZGCMKAXIVHBIVBXBDWVMWRIUTDUTCMKUNKJFWYSXXKCVWKPKWPIMZOOOPUXGUKRRJXRUWWBCSCEKGFDRWVLDPOSVMURRLSWOPCIZIYELZTWDSYIEFRFOUVTQIPABIJVVKWWWLWCFFDZUUMYNSCJVSRKDVQCWXCOEXTXMIUH
HCSUWPFLWOGUXPXUIBKWFOOTEOIELUXVZWIEESPKRUWXKRVMUJCRVMUJCWIWJDKQIYLDEXPKSMWICMNCXOPFUWUMCCFVTYIRLCJOPYCMBGLRTYPWUMCOXQSFVVSZRVSROKWTVHZUJONUTREBTTVNCJUDIUWCROWFUWVSGAHSVPFULMXDYWIOWCMRBKZVJDDIUWTVTXUMWVFEKMLBFTPVDWUMCKTBXBORHLSOAXKRORUWARZOSFWGIKNUXAUJZLSWXEKUX
HUIMXTXEOCXWCQVDKRSVJCSNYMUUZDFFCWLWWWKVVJIBAPIQTVUOFRFEIYSDWTZLEYIZICPOWSLRRUMVSOPDLVWRDFGKECSCBWWURXJRRKUGXUPOOOZMIPWKPKWVCKXXSYWFJKNUKMCTUDTUIRWMVWDBXBVIBHVIXAKMCGZSUBUWUMLUGWOJFJNRJATRZOCCTOHVHLORXYNSTLSTVOPUVXSWEMPWTPUOXOUFURFMAEIJUM
@jameslyons
jameslyons / pdb2fasta.py
Last active January 4, 2020 04:15
convert pdb file to fasta
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 December 1, 2014 12:10
spectral subtraction demo in matlab
[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 August 29, 2015 14:10
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 February 10, 2014 07:26
delastelle cipher in python
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 February 10, 2014 06:19
burg method of LPC computation
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