This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^1:: | |
Send, !sw | |
Return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @ShortcutManager | |
// @name open url in new window | |
// @namespace NIEQCKdtMwoR | |
// @key Ctrl+] | |
// @include * | |
// ==/UserScript== | |
javascript:window.open(window.location.href) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Inspired by https://github.com/chaosong | |
vmap <f6> :FormatJson <cr> | |
command -range FormatJson :call FormatJson() | |
function! FormatJson() range | |
let [lnum1, col1] = getpos("'<")[1:2] | |
let [lnum2, col2] = getpos("'>")[1:2] | |
python << EOF | |
import vim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from functools import reduce | |
from sys import argv | |
def partial_fact(tries, success): | |
m = range(tries - success + 1, tries + 1) | |
return reduce((lambda x,y: x*y), m) | |
def fact(n): | |
return reduce((lambda x,y: x*y), range(1, n+1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import $ivy.`org.scalikejdbc::scalikejdbc:2.4.2`, scalikejdbc.ConnectionPool, scalikejdbc._ | |
import $ivy.`mysql::mysql-connector-java:5.1.32` | |
Class.forName("com.mysql.jdbc.Driver").newInstance() | |
val (url, | |
user, | |
password, | |
driver) = ("jdbc:mysql://172.17.0.2:3306/test_database", | |
"root", | |
"foo", | |
"com.mysql.jdbc.Driver") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.scalameter._ | |
import common._ | |
import scala.math.pow | |
val standardConfig = config( | |
Key.exec.minWarmupRuns -> 40, | |
Key.exec.maxWarmupRuns -> 80, | |
Key.exec.benchRuns -> 100, | |
Key.verbose -> false | |
) withWarmer(new Warmer.Default) |
OlderNewer