Skip to content

Instantly share code, notes, and snippets.

@sg-s
sg-s / automatic-version-numbers.md
Last active March 3, 2024 10:07
Automatic version numbers of your git repository using git hooks

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

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

git rev-list --count master > build_number
git add build_number
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Srinivas Gorur-Shandilya <code@srinivas.gs>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.12"
@sg-s
sg-s / bash history autocomplete
Last active August 1, 2023 04:04
Autocomplete commands in bash by using arrow keys
# supports history search using up and down arrows
# add this to your ~/.bashrc
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
bind '"\eOA": history-search-backward'
bind '"\eOB": history-search-forward'
[tool.poetry]
name = "ideas-python-utils"
version = "23.1.31"
description = "Python utilities for tools in IDEAS"
authors = ["Srinivas Gorur-Shandilya <srinivas@inscopix.com>"]
readme = "README.md"
packages = [{include = "ideas"}]
[tool.poetry.dependencies]
python = ">=3.9,<3.12"
@sg-s
sg-s / poetry-apple-silicon.md
Created January 9, 2023 20:18
Getting poetry working on Macs with Apple Silicon

Problem

poetry shits the bed when trying to install ipykernel on Macs with Apple Silicon

reason

Microsoft.

Yeah. They made something called debugpy that ipykernel depends on which fails for inscritable reasons.

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
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 / julia-dev.md
Last active June 14, 2021 13:26
Developing packages in Julia

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 / spike-sorting.md
Last active June 11, 2021 18:05
Spike sorting Review

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 / github-with-more-than-one-person.md
Last active April 23, 2021 17:10
Github with more than one person

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