Skip to content

Instantly share code, notes, and snippets.

@nachocab
nachocab / heatmap3.R
Created October 8, 2012 15:06
heatmap 3 revised
# EXAMPLE USAGE
# example of colsidecolors rowsidecolors (single column, single row)
mat <- matrix(1:100, byrow=T, nrow=10)
column_annotation <- sample(c("red", "blue", "green"), 10, replace=T)
column_annotation <- as.matrix(column_annotation)
colnames(column_annotation) <- c("Variable X")
row_annotation <- sample(c("red", "blue", "green"), 10, replace=T)
row_annotation <- as.matrix(t(row_annotation))
@nachocab
nachocab / immgen.tsv
Last active October 17, 2023 15:49
Human-readable version of IMMGEN annotation codes
activated_T_cells T.8Nve.Sp.OT1 spleen OT1 tg Naïve CD8 OT-I tg 6W spleen transfer of 5x10^3 OTI cells Listeria.OVA 5x10^3 cfu
activated_T_cells T.8Eff.Sp.OT1.d6.LisOva spleen OT1 tg effectors CD8 day 6 Listeria.OVA 4- 8+ 45.1+ OT-I tg > B6.CD45.2 6W spleen transfer of 5x10^3 OTI cells Listeria.OVA 5x10^3 cfu
activated_T_cells T.8Eff.Sp.OT1.d8.LisOva spleen OT1 tg effectors CD8 day 8 Listeria.OVA 4- 8+ 45.1+ OT-I tg > B6.CD45.2 6W spleen transfer of 5x10^3 OTI cells Listeria.OVA 5x10^3 cfu
activated_T_cells T.8Eff.Sp.OT1.d10.LisOva spleen OT1 tg effectors CD8 day 10 Listeria.OVA 4- 8+ 45.1+ OT-I tg > B6.CD45.2 6W spleen transfer of 5x10^3 OTI cells Listeria.OVA 5x10^3 cfu
activated_T_cells T.8Eff.Sp.OT1.d15.LisOva spleen OT1 tg effectors CD8 day 15 Listeria.OVA 4- 8+ 45.1+ OT-I tg > B6.CD45.2 6W spleen transfer of 5x10^3 OTI cells Listeria.OVA 5x10^3 cfu
activated_T_cells T.8Mem.Sp.OT1.d45.LisOva spleen OT1 tg Memory CD8 day 45 Listeria.OVA 4- 8+ 45.1+ OT-I tg
@nachocab
nachocab / viterbi.rb
Created October 10, 2011 16:12 — forked from misshie/viterbi.rb
A Ruby implementation of the Viterbi algorithm based on the hidden Markov model (HMM)
# A Ruby implementation of
# the Viterbi algorithm based on the hidden Markov model (HMM)
#
# An original Python code: a Wikipedia page "Viterbi algorithm" at
# http://en.wikipedia.org/wiki/Viterbi_algorithm
#
# Author: MISHIMA, Hiroyuki
#
require 'pp'
@nachocab
nachocab / instructions.sh
Last active February 13, 2022 15:45
How to make git diff work perfectly with .docx files in Mac OS X (it even colors by word)
# download docx2txt by Sandeep Kumar
wget -O docx2txt.pl http://www.cs.indiana.edu/~kinzler/home/binp/docx2txt
# make a wrapper
echo '#!/bin/bash
docx2txt.pl $1 -' > docx2txt
chmod +x docx2txt
# make sure docx2txt.pl and docx2txt are your current PATH. Here's a guide
http://shapeshed.com/using_custom_shell_scripts_on_osx_or_linux/
@nachocab
nachocab / new_mac.txt
Last active April 30, 2018 15:30
New mac checklist
## General
### System preferences
# change date and regional settings
language & region | region | spain
date & time | clock | show date
# change trackpad
point & click
enable tap to click
change secondary click to bottom right corner
disable look up
@nachocab
nachocab / treccani.js
Last active January 10, 2018 13:27
Treccani
// Custom JavaScript for Websites Chrome Extension Script for
// the italian dictionary www.treccani.it
// Author: Nacho - NachoTime Spanish
// URL: itsnachotime.com
// License: MIT
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = `
.accezione + .sottoaccezione hr {
@nachocab
nachocab / custom_glosbe.js
Created December 17, 2017 18:17
Customized Glosbe Dictionary - NachoTime Spanish
// Author: Nacho - NachoTime Spanish
// URL: bit.ly/nachotime_vocab
// License: MIT
function newLink(opts) {
let link = document.createElement('a');
link.href = opts.href;
link.innerHTML = opts.content;
link.target = opts.newTab ? '_blank' : '';
link.style = opts.style;
get_sparse_pca <- function(gbm, n_pcs = 10, fastpath = FALSE) {
x <- as.matrix(t(Biobase::exprs(gbm)))
mu <- colMeans(x)
s <- apply(x, 2, sd, na.rm = TRUE)
s[s == 0] <- min(s[s > 0])
svd_res <- irlba::irlba(x, nv = n_pcs, center = mu, scale = s, fastpath = fastpath)
n <- dim(x)[1]
variance_sum <- sum(apply(x, 2, var, na.rm = TRUE)/(s^2))
var_pcs <- svd_res$d^2/(n - 1)/variance_sum
pca_with_outliers <- list(
const stampit = require('stampit')
Grade = stampit({
init(percentage) {
this.percentage = percentage
this.grades = [
{letter: 'A', minimumPercentage: 0.9, passing: true},
{letter: 'B', minimumPercentage: 0.8, passing: true},
{letter: 'C', minimumPercentage: 0.7, passing: true},
{letter: 'D', minimumPercentage: 0.6, passing: true},
El director del periódico de La Razón, Francisco Marhuenda, ha sido nombrado comisario honorario de la Policía Nacional por decisión del ministro del Interior en funciones, Jorge Fernández Díaz, han informado a eldiario.es fuentes policiales. El reconocimiento al periodista se produce a punto de cumplirse cuatro meses del Gobierno en funciones y cuando unas nuevas elecciones generales se avistan para el próximo mes de junio.
La Ley Orgánica 9/2015, de Régimen de Personal de la Policía Nacional, establece en su artículo 86.2 que “la distinción de miembro honorario de la Policía Nacional podrá otorgarse a aquellas personas que, no habiendo pertenecido al citado Cuerpo, se hubieran distinguido por los merecimientos contraídos en virtud de la labor realizada a favor del mismo”.
El expediente en el que se recogen los méritos para recibir la distinción es interno y no se hace público, por lo que resulta imposible conocer qué actuaciones ha protagonizado el agraciado para recibirla. La semana pasada, la Audiencia