Skip to content

Instantly share code, notes, and snippets.

@cmdcolin
cmdcolin / changes.md
Last active May 3, 2025 17:49
changes.md

Text-editor saturday

My text editor avante.nvim is just going crazy. Previously it dumped diffs into the 'chat sidebar', and I'd accept them with "A" in the sidebar then accept all with "ca" in the main area...vibe coding. But the avante.nvim switched to running tools that run the edits instead, and is just going crazy with tool usage despite me having disable_tools enabled. I dunno. Maybe I should file a bug. But this spurred me to try to work holistically on my editing skills this morning. I just looked at my config and tweaked a million things...

Trying out rose-pine

Trying rose-pine color scheme. It is kinda funny with tons of italic but it's cute

@cmdcolin
cmdcolin / b73_converter.ts
Created April 22, 2025 17:02
b73_converter.ts
import fs from 'fs'
const tracks = JSON.parse(fs.readFileSync(process.argv[2], 'utf8')) as {
tracks: any[]
}
const asm = 'B73'
const assemblyNames = [asm]
const base = 'https://jbrowse.maizegdb.org/B73/'
console.log(
@cmdcolin
cmdcolin / gist:d18669f9b7467d55239ec3d9a7115f52
Last active April 25, 2025 15:16
the json version of an agentic ai discussion some user had
[
{ "role": "user", "type": "message", "content": "hello" },
{
"role": "assistant",
"type": "message",
"content": "Hello! How can I help you today?\n"
},
{
"role": "user",
"type": "message",
@cmdcolin
cmdcolin / out.tsv
Last active March 9, 2025 17:24
plot.R
program size time mean sd
biojsmsa 1024 1.7980085814 1.7634212551000001 0.054614392814706154
biojsmsa 1024 1.7561014924 1.7634212551000001 0.054614392814706154
biojsmsa 1024 1.7711577354 1.7634212551000001 0.054614392814706154
biojsmsa 1024 1.6753254374000002 1.7634212551000001 0.054614392814706154
biojsmsa 1024 1.7957582314 1.7634212551000001 0.054614392814706154
biojsmsa 1024 1.8305949124 1.7634212551000001 0.054614392814706154
biojsmsa 1024 1.8173887264 1.7634212551000001 0.054614392814706154
biojsmsa 1024 1.7924422974 1.7634212551000001 0.054614392814706154
biojsmsa 1024 1.6920777054 1.7634212551000001 0.054614392814706154
@cmdcolin
cmdcolin / gist:053b46493eb6066ac64e19ae43093456
Last active April 25, 2025 15:23
hap-ibd to bed file (not plink bed, just normal genome track bed)
#!/bin/bash
# create a bed file from hap-ibd output with columns "chr, start, end, sample_name1 hap1 sample_name2 hap2"
# add this config to jbrowse get(feature,'sample1')+':HP'+get(feature,'hap1')+' '+get(feature,'sample2')+':HP'+get(feature,'hap2')
# Process file in a fully streaming fashion and pipe directly to bgzip
# Combine header and data in a single stream
(
echo -e "#chr\tstart\tend\tsample1\thap1\tsample2\thap2"
zcat "$1" | awk -F'\t' '{print $5"\t"$6"\t"$7"\t"$1"\t"$2"\t"$3"\t"$4}'
@cmdcolin
cmdcolin / gist.md
Last active March 2, 2025 20:14
fix for baobab deleting wrong folder

Fixing Disk Usage Analyzer (aka baobab) bug where it was deleting the wrong file

Issue thread https://gitlab.gnome.org/GNOME/baobab/-/issues/157#note_2367208

Background on the bug

The Disk Usage Analyzer app (aka baobab) has a "bug" where if you right-click a file, it brings up a context menu and you can then click "Move to Trash". However, if your mouse moves outside the context menu, then it "highlights" or "selects" a different file with the context menu still open, and then trashes the newly highlighted/selected file instead of the one that you originally right-clicked

image

If you want to publish ESM/CJS you can update your package.json to use the
"exports" field, and run the tsc compiler twice over the code, once using
--module cjs
```json
{
"name": "dualpackage",
"version": "1.0.0",
"description": "demo of dual esm/cjs package",
@cmdcolin
cmdcolin / static_jbrowse.md
Last active February 4, 2025 14:47
Using JBrowse on a static file host

One thing that is important to note about JBrowse is that it is a "static site compatible application"

What is a "static site"?

A static site is just a set of plain files like HTML, JS, and CSS

Static sites don't use dynamic "server side" code like PHP, Node.js, Java Servlets, or things like that.

@cmdcolin
cmdcolin / eslint.config.mjs
Last active February 22, 2025 15:18
example eslint v9 config for a vite app
import eslint from '@eslint/js'
import importPlugin from 'eslint-plugin-import'
import eslintPluginReact from 'eslint-plugin-react'
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
import tseslint from 'typescript-eslint'
export default tseslint.config(
{
// might be able to find a way to not ignore some of these but i just ignore them
ignores: [
@cmdcolin
cmdcolin / breakpoints.md
Last active January 3, 2025 17:30
How to access breakpoint split view in jbrowse 2

JBrowse 2 has a special "view type" called the "breakpoint split view" that allows you to see the connection between split long reads (e.g. SA tag) and paired-end reads

Ways to access the breakpoint split view

Using the SV inspector to launch a breakpoint split view

The SV inspector lets you load a VCF containing SV calls and then will launch a "breakpoint split view". Note that the breakpoint split view that it launches will be empty but you can then add your BAM or CRAM reads to it (on both top and bottom levels sometimes is needed)