Skip to content

Instantly share code, notes, and snippets.

View harusametime's full-sized avatar
:octocat:
Loving Sake and coding

Masaki Samejima harusametime

:octocat:
Loving Sake and coding
View GitHub Profile
@harusametime
harusametime / jupyter_error_jp.md
Last active November 6, 2017 08:02
Jupyter notebookをubuntuで起動してエラーが出たとき
$ jupyter notebook
...
OSError: [Errno 99] Cannot assign requested address

こういう風にいれましょう.

$ jupyter notebook --ip=127.0.0.1
@harusametime
harusametime / fujixerox_printer_ubuntu.md
Created January 5, 2018 10:58
How to install Fujixerox printer in ubuntu 16.04

What

This is how to install Fujixerox C5000-d printer in ubuntu 16.04. Unfotunately, the official printer driver is too old to be compatibe with latest ubuntu.

Step

  1. Download "fxlinuxprint_1.1.0+ds.orig.tar.xz" in Launchpad[https://launchpad.net/ubuntu/+source/fxlinuxprint/1.1.0+ds-2]
  2. Extract the tar.xz file.
tar Jxfv fxlinuxprint_1.1.0+ds.orig.tar.xz
  1. Search and run "Printer" from "Dash" that is the top icon in launcher
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import argparse
import tensorflow as tf
# global variables
width = 28
height = 28
n_class = 10
# tfrecord parser
@harusametime
harusametime / error_load_npz.md
Last active July 12, 2019 09:07
npz保存時の注意

Numpyで複数のndarrayを保存するとき,npzを使うのは便利だが

import numpy as np

X = np.zeros((100,100))
y = np.zeros(10)

file_path = /home/samejima/data.npz
np.savez(file_path, x = X, y=y) 
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import boto3
redshift = boto3.client('redshift')
credentials = redshift.get_cluster_credentials(
DbUser='demouser',
DbName='dev',
ClusterIdentifier='redshiftml',
DurationSeconds=3600,
AutoCreate=False
)
@harusametime
harusametime / joblib_on_docker.md
Last active February 11, 2022 20:18
Note on joblib with docker

Problem

When passing big arrays to joblib.Parallel in docker container, parallel processing does not start immediately.

Why?

Joblib uses the folder specified by "JOBLIB_TEMP_FOLDER" for memmap of the arrays. Without specifying, JOBLIB_TEMP_FOLDER is set to /dev/shm, which usually has small size and is not enough for the big arrays.

https://pythonhosted.org/joblib/generated/joblib.Parallel.html

Solution

  • Set JOBLIB_TEMP_FOLDER