Skip to content

Instantly share code, notes, and snippets.

@withrocks
withrocks / .vimrc
Last active October 17, 2025 08:26
GitRebaseAnnotate: Annotate the interactive rebase buffer with the files being changed
command! GitRebaseAnnotate call GitRebaseAnnotate()
function! GitRebaseAnnotate()
" Save cursor position
let l:pos = getpos('.')
" Work from bottom to top to avoid line number shifting
for lnum in reverse(range(1, line('$')))
let line = getline(lnum)
if line =~# '^#' || line =~# '^\s*$'
@withrocks
withrocks / process_multisession_folder.py
Last active April 5, 2018 16:10
Gather anitracker data into one csv
from __future__ import print_function
import os
import re
import sys
from os import listdir
import logging
SEPS = ";\t,"
# Tests the workflow `something` in Clarity, mostly (not entirely) by selenium calls
import luigi
import json
"""
These are our fake workflows in Clarity:
- Import samples
- Assign samples to workflow A or B
- Workflow A:
- Do qc on instrument qc1 or qc2
@withrocks
withrocks / rebase.md
Last active April 30, 2019 14:39
Git rebase with reordering

Up until now, i've mostly done simple rebases, i.e. picking the first commit, squashing all other. But the tool is much more powerful than that. One can move the commits around at will. This can make it trivial to simplify complex pull requests.

Example: You have two features in the same branch, let's call them cleanup and fixes. You commit at will using a commit message that identifies them, say like this:

git commit -m "cleanup 1"
git commit -m "fixes 1"
git commit -m "cleanup 2"
@withrocks
withrocks / sqlite_cache.py
Created August 31, 2015 13:08
SqliteCache
import sqlite3
import logging
import os.path
from time import strftime
class SqliteCache:
def __init__(self, database_name='cache.sqlite3', logger=None):
self._logger = logger or logging.getLogger(__name__)
self._database_name = database_name
self._ensure_db_exists()
@withrocks
withrocks / st2.build.log
Created June 3, 2015 13:28
Error while installing st2express v0.9.0
# command: sudo docker build -t st2 . | tee -a st2.build.log
------------------------------------------------------------
Sending build context to Docker daemon 7.168 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu:14.04
---> fa81ed084842
Step 1 : ENV DEBIAN_FRONTEND noninteractive
---> Using cache