Skip to content

Instantly share code, notes, and snippets.

View Puriney's full-sized avatar

Yun YAN Puriney

View GitHub Profile
@Puriney
Puriney / tryXavier.R
Created February 29, 2016 07:34
PoC of Xavier initializer for mxnet
# Using regerssion as example to test my xavier initilizer
# Data
data(BostonHousing, package="mlbench")
train.ind = seq(1, 506, 3)
train.x = data.matrix(BostonHousing[train.ind, -14])
train.y = BostonHousing[train.ind, 14]
test.x = data.matrix(BostonHousing[-train.ind, -14])
test.y = BostonHousing[-train.ind, 14]
@Puriney
Puriney / setup.sh
Last active April 1, 2016 02:26
Set up new droplet
# create rootless, set up sudo user
# https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04
sudo apt-get update
sudo apt-get install git
sudo apt-get install ruby
# install linux homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/linuxbrew/go/install)"
# vim ~/.bashrc
export PATH="$HOME/.linuxbrew/bin:$PATH"
@Puriney
Puriney / .spacemacs
Created April 1, 2016 02:10
.spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@Puriney
Puriney / yun.sublime-settings
Created August 18, 2016 23:34
subl_user_settings
{
"bold_folder_labels": true,
"color_scheme": "Packages/User/SublimeLinter/Solarized (Light) (SL).tmTheme",
"fade_fold_buttons": false,
"font_size": 16,
"highlight_line": true,
"ignored_packages":
[
"Markdown",
"Vintage"
@Puriney
Puriney / .gitignore_global
Created August 22, 2016 16:41
.gitignore global
# Created by http://www.gitignore.io
*.xcodeproj/*
### Xcode ###
DerivedData/*
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
@Puriney
Puriney / demoParallel.py
Last active August 23, 2016 19:52
Run parallel bash jobs in python by multiprocessing and subprocess modules
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
- multiprossing 101
- whether multiprocessing could contain subprocess work
@contact: Yun Yan ([email protected])
"""
import subprocess
from multiprocessing import Pool
import os
@Puriney
Puriney / README.md
Last active August 24, 2016 13:20
Mini example of showing intra-package importing

Folder structure:

__init__.py is a blank file.

├── RandInit_HMM_Py
│   ├── __init__.py
│   ├── demoRunPkg.py
│   ├── demoRunIn.py
|.. ├── helper.py
@Puriney
Puriney / fail_loop_ruffus.py
Created August 24, 2016 13:59
Demo of failing run loop in ruffus
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@contact: Yun Yan ([email protected])
"""
from ruffus import *
from helper import *
@Puriney
Puriney / remove_edge.R
Last active February 14, 2017 03:39
Minimum example to remove edges connecting nodes of interest
set.seed(1234)
g <- sample_gnp(n=10, 0.15) #make_ring(10)
V(g)$name <- letters[1:10]
plot(g)
rm_e <- combinations(n=3, r=2, v=c('b', 'i', 'c'))
rm_e_do <- apply(rm_e, 1, function(r) are.connected(g, r[1], r[2]))
rm_e <- rm_e[rm_e_do, ] %>% apply(., 1, paste, collapse='|')
par(mfrow=c(1, 2))
plot(g)
plot(g - edge(rm_e))
@Puriney
Puriney / pandas_sparse_matrix.ipynb
Created May 15, 2017 19:54
Working on sparse matrix in Python: Create Pandas sparse data frame from matrix-market format.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.