Skip to content

Instantly share code, notes, and snippets.

Roman Valls Guimera brainstorm

Block or report user

Report or block brainstorm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brainstorm
brainstorm / anritsu_symbols_dump.py
Created Aug 17, 2019
Anritsu MS2721B quick and dirty over-telnet symbol enumeration
View anritsu_symbols_dump.py
#!/usr/bin/env python
import re
import csv
import telnetlib
from collections import defaultdict
## EXAMPLE FROM MS2721B telnet session
TEST_PAYLOAD='''lkAddr 0\r\n0x0c002000 _usrEntry text \r\n0x0c002040 _sysInit text \r\n0x0c002064 _intPrioTable text \r\n0x0c0
0216c _intPrioTableSize text \r\n0x0c002180 _ataDrv text \r\n0x0c002e40 _ataDevCreate text \r\n0x0c0030c0 _ataRawio
@brainstorm
brainstorm / htslib_idx_load.c
Created Mar 27, 2019
htslib access (un)compressed offsets
View htslib_idx_load.c
#include <stdio.h>
#include <stdlib.h>
#include <htslib/hts.h>
#include <htslib/bgzf.h>
#include <hts_internal.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char **argv)
@brainstorm
brainstorm / htsget-openapi-factored.yaml
Last active May 17, 2019
htsget-openapi-factored.yaml
View htsget-openapi-factored.yaml
openapi: 3.0.0
servers:
- description: htsget genomics api
url: https://virtserver.swaggerhub.com/brainkod/htsget/1.1.1
info:
description: "This data retrieval API bridges from existing genomics bulk data transfers to a client/server model"
version: "1.1.1"
title: htsget
contact:
name: GA4GH
View igv_server_setup.md

Minimal NGINX configuration on the server side

WARNING: These notes are going to be eliminated by automation anytime soon (see Future section below).

Edit the file under /etc/nginx/sites-available/default to make sure it looks like this (read SSL section below for the encryption bits):

server {
        auth_basic "UMCCR AWS IGV Server";
        auth_basic_user_file /etc/nginx/htpasswd;
@brainstorm
brainstorm / igv_regenerate.sh
Last active Dec 19, 2018
IGV S3 to HTTP bridge
View igv_regenerate.sh
#!/bin/bash
##### CONFIG
S3FUSE_MNT=/mnt/igv
IGV_NGINX_MNT=/var/www/igv
IGV_XML_HEAD="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Global name=\"UMCCR AWS IGV server\" version=\"1\">\n<Category name=\"UMCCR Amazon IGV bucket\">"
IGV_XML_BODY_TMPL="<Resource name=\"SAMPLE\" path=\"URL\"></Resource>\n"
IGV_XML_TAIL="</Category>\n</Global>\n"
IGV_XML_BODY_ARRAY=()
@brainstorm
brainstorm / esc_motor_pseudo.c
Created Sep 5, 2018
ARDrone ESC motor pseudocode (with r2dec decompiler, pdd command)
View esc_motor_pseudo.c
#include <stdint.h>
#include <limits.h>
#define DISABLE_INTERRUPTS __asm(cli)
#define ENABLE_INTERRUPTS __asm(sei)
#define MEM_X ((uint16_t*)((r27 << 8) | r26))
#define MEM_Y ((uint16_t*)((r29 << 8) | r28))
#define MEM_Z ((uint16_t*)((r31 << 8) | r30))
@brainstorm
brainstorm / openscad_trolley.scad
Created Mar 25, 2018
OpenSCAD trolley fix for titan bags
View openscad_trolley.scad
/*
This is a titan bags (https://www.titan-bags.com/) custom part replacement. This piece goes inside the
"telescopic" handle bar after removing two screws. The mechanism is brittle and breaks with repeated
pressure to the main button, leading to an "always locked" position of the telescopic bars.
I've printed this part successfully with PETG 3D printing material via http://3dhubs.com.
*/
View XHC Mach3 CNC USB comms dump.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brainstorm
brainstorm / pcgr.service
Last active Feb 27, 2018
systemd with python3 virtualenv does not find modules
View pcgr.service
(venv) ubuntu@localhost:/etc/systemd/system$ sudo cat pcgr.service
[Unit]
Description=PCGR sample consumer process
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/home/ubuntu
ExecStart=/mnt/pcgr/venv/bin/python3 /mnt/pcgr/pcgr_consumer.py pcgr ap-southeast-2 pcgr 10 10 /home/ubuntu
@brainstorm
brainstorm / jekyll_blogdown_migrate_posts.md
Created Feb 11, 2018
Fix posts metadata to migrate from Jekyll to Blogdown
View jekyll_blogdown_migrate_posts.md
#!/usr/bin/env python
import os
from pathlib import Path
import datetime
import frontmatter
posts_root = os.environ['HOME'] / Path('dev/brainblog/content/post')
for post in posts_root.iterdir():
You can’t perform that action at this time.