Skip to content

Instantly share code, notes, and snippets.

Avatar
🦕

Srinivas Gorur-Shandilya sg-s

🦕
View GitHub Profile
@sg-s
sg-s / spike-sorting.md
Last active Jun 11, 2021
Spike sorting Review
View spike-sorting.md

Spike sorting packages

Name Platform Notes
kilosort MATLAB + drift correction, GPU
mountainsort
  1. mountainsort
  2. wave_clus wavelets + super-paramagnetic clustering
@sg-s
sg-s / julia-dev.md
Last active Jun 14, 2021
Developing packages in Julia
View julia-dev.md

What you want to do:

  • Write a package in Julia and develop it with the ultimate goal of releasing it for others to use

How to do it

  1. Open Julia
  2. Install PkgTemplates using using Pkg; Pkg.add("PkgTemplates")
  3. using PkgTemplates
  4. Create a template using your git user name: t = Template(user="sg-s")
@sg-s
sg-s / github-with-more-than-one-person.md
Last active Apr 23, 2021
Github with more than one person
View github-with-more-than-one-person.md

You submitted a patch to someone else's repository, and now you want your fork to sync with their repo

  1. Clone your fork (if you haven't already)
  2. git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
  3. git fetch upstream
  4. git pull upstream master

Someone else has opened a PR on your repo, and you want to check that their code works before merging

View Data logging in MATLAB.md

A common problem in software development and research is the "do-something"-"save data" loop. Often we are saving structured data over and over again, and this document looks at the fastest way to do this.

Solutions I will not consider

Writing each chunk of data to its own file

I will not consider this because:

  1. how do we combine these files later? This just kicks the can down the road
@sg-s
sg-s / matlab-basic.md
Last active Feb 10, 2021
Extremely basic MATLAB crash course
View matlab-basic.md

How to make a vector

a = [1; 2; 3]
a = [1, 2, 3] % avoid
a = zeros(10,1)
a = ones(10,1)
a = NaN(10,1)
a = linspace(0,1,10)
a = logspace(-1,1,10)
@sg-s
sg-s / data-falsehoods.md
Last active May 28, 2020
Falsehoods I beleived about real data, and the price I paid for it
View data-falsehoods.md

The data exists

If data is split across multiple files that are sequentially numbered, then it is foolish to beleive that every file exists. Some files can go missing, or be corrupted.

Files with the same name and the same size contain the same data

I learnt the hard way that one version can be corrupted, and the other version is fine, and it's all too easy to replace to good version with the corrupted version

View DNS servers
Alternate DNS
198.101.242.72
23.253.163.53
BlockAid Public DNS (or PeerDNS)
205.204.88.60
178.21.23.150
Censurfridns
91.239.100.100
@sg-s
sg-s / matlab-data-saving.md
Created Sep 29, 2016
A note on saving data in MATLAB
View matlab-data-saving.md

The problem

We want to save data as it is generated, and to save it as a .mat file. Since every trial can be of a different length, a simple matrix will not suffice.

We have the following two options:

cell_data.x{1} = randn(1e4,1);
cell_data.y{1} = randn(1e4,1);
@sg-s
sg-s / automatic-version-numbers.md
Last active Mar 30, 2021
Automatic version numbers of your git repository using git hooks
View automatic-version-numbers.md

Put this in a file called pre-commit in .git/hooks/

#!/bin/sh
# To enable this hook, rename this file to "pre-commit".

git log master --pretty=oneline | wc -l > build_number
git add build_number
@sg-s
sg-s / frozen-random.md
Last active Aug 29, 2015
One line frozen noise generator in MATLAB
View frozen-random.md
RandStream.setGlobalStream(RandStream('mt19937ar','Seed',1984)); 

sets the randsom stream to a particular state. (1984 because this is the most True state). Make sure you run this before every invocation of rand:

>> RandStream.setGlobalStream(RandStream('mt19937ar','Seed',1984)); 
>> rand(3)
ans =