Skip to content

Instantly share code, notes, and snippets.

@vascoosx
vascoosx / item_item_prod.scala
Created May 30, 2016 08:24
calculate all combinations
import scala.collection.mutable
import org.apache.spark.mllib.linalg._
import org.apache.spark.mllib.rdd.MLPairRDDFunctions._
import org.apache.spark.rdd.RDD
def blockify(rank: Int,
features: RDD[(Int, Array[Double])]): RDD[(Array[Int], DenseMatrix)] = {
val blockSize = 4096 // TODO: tune the block size
val blockStorage = rank * blockSize
features.mapPartitions { iter =>
@vascoosx
vascoosx / sort_xml.py
Last active September 17, 2021 15:04
custom sorting xml
# -*- coding: utf-8 -*-
"""
Created on Tue May 24 06:12:11 2016
@author: sh.otsuka
"""
# experiment based on http://stackoverflow.com/a/8387132/1635993
from lxml import etree
@vascoosx
vascoosx / .tmux
Last active April 12, 2016 01:42
tmux
set-option -g prefix C-j
unbind-key C-b
bind-key C-j send-prefix
bind-key C-j last-window
bind c new-window -c "#{pane_current_path}"
bind "\"" split-window -v -c "#{pane_current_path}"
set-window-option -g mode-keys vi
# list-keys -t vi-copy
@vascoosx
vascoosx / .vimrc
Last active December 17, 2018 08:22
vimrc
execute pathogen#infect()
filetype plugin indent on " filetype detection and settings
syntax on " syntax highlighting
silent! runtime macros/matchit.vim " matchit comes with Vim
set nocompatible " not strictly necessary but useful in some scenarii
set backspace=indent,eol,start " let the backspace key work "normally"
set hidden " hide unsaved buffers
set incsearch " incremental search rules
set laststatus=2 " not strictly necessary but good for consistency
set ruler " shows line number in the status line