Skip to content

Instantly share code, notes, and snippets.

View JirenJin's full-sized avatar
🎯
Focusing

Jiren Jin JirenJin

🎯
Focusing
View GitHub Profile
@JirenJin
JirenJin / jupyter_save_script.py
Created September 10, 2018 10:41
Solve the automatically created `Untitled.txt` problem for Jupyter Lab. Automatically save a copy of notebook to the corresponding language source script, excluding notebooks with "Untitled" names.
import io
import os
import re
from nbconvert.exporters.script import ScriptExporter
from notebook.utils import to_api_path
def script_post_save(model, os_path, contents_manager, **kwargs):
"""Save a copy of notebook to the corresponding language source script.
@JirenJin
JirenJin / train_mnist.py
Created April 18, 2018 16:51
Reproduce the problem related to `Chainer.datasets.TransformDataset` and `Chainer.training.Evaluator`.
#!/usr/bin/env python
import argparse
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import training
from chainer.training import extensions
from chainer.datasets import TransformDataset
import matplotlib
@JirenJin
JirenJin / pyenv_with_shared_objects.sh
Created April 3, 2018 11:57
default `pyenv install x.x.x` only installs python version without support of shared objects (some libs need these), this line of code solves the problem.
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.5