Skip to content

Instantly share code, notes, and snippets.

Avatar

Tomoyuki Nohara peace098beat

View GitHub Profile
View ml-memo.md
@peace098beat
peace098beat / ascii.py
Created Sep 10, 2021
[ASCII] #python #ascii
View ascii.py
import cv2
density = list("MWN$@%#&B89EGA6mK5HRkbYT43V0JL7gpaseyxznocv?jIftr1li*=-~^`':;,. ")
LEN = len(density)
def image_print(image, wid=30):
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
resized = cv2.resize(gray, (int(wid*2),int(wid)))
for i in range(resized.shape[0]):
s = ""
@peace098beat
peace098beat / build_html.py
Created Aug 4, 2021
[html-build] #matplotlib #python
View build_html.py
def build_html(paths):
html = """<style> .c {width:300px; float:left;} </style>"""
for p in paths:
html+= f"""<img class='c' src='./ALL/{p.name}'></img>\n"""
return html
SAVE_DIR = Path(FIG_OUT_DIR) / "ALL"
chart_paths = list(Path(SAVE_DIR).glob("*.jpg"))
@peace098beat
peace098beat / spec.py
Last active Jul 24, 2021
[Google Colab] #colab #python
View spec.py
# Scrach Pad
# https://colab.research.google.com/notebooks/empty.ipynb
# KaggleOps
# [KaggleOpsを考える ~ MLflow + Colaboratory + Kaggle Notebook ~ | GMOインターネットグループ 次世代システム研究室](https://recruit.gmo.jp/engineer/jisedai/blog/kaggleops-mlflow/)
# GPU
# NVIDIA GPUスペック(機械学習用)https://qiita.com/yukoba/items/10d0ba3fb1d19a6ab6a5
!nvidia-smi
View setup-tabnine.sh
pip3 install jupyter-tabnine --user
jupyter nbextension install --py jupyter_tabnine --user
jupyter nbextension enable --py jupyter_tabnine --user
jupyter serverextension enable --py jupyter_tabnine --user
# for pipenv
pipenv install --dev jupyter-tabnine --user
pipenv run jupyter nbextension install --py jupyter_tabnine --user
pipenv run jupyter nbextension enable --py jupyter_tabnine --user
@peace098beat
peace098beat / M1.py
Last active Oct 2, 2021
[env setup] snippets #python #setup #pipenv #env
View M1.py
# M1
# pyenv
# (* brewはuser homeにインストールしてください)
brew install pyenv
# pipenv
pip3 install --user pipenv
pipenv --python 3
@peace098beat
peace098beat / python
Created May 18, 2019
Pythonのヴァージョン確認
View python
import sys
# Check Python Version
if sys.version_info.major < 3:
sys.stderr.write('Please use python 3.x\n')
sys.stderr.write(
'Your python version is as following:{}\n'.format(sys.version))
exit()
View webgl.sample2.js
<!DOCTYPE html>
<html>
<body>
<style type="text/css">
body {
border: 1;
background-color: gray;
}
View webgl.sample1.js
<!DOCTYPE html>
<html>
<body>
<style type="text/css">
body {
border: 1;
background-color: gray;
}
@peace098beat
peace098beat / webgl-sample.js
Created Nov 16, 2018
three.js WebGLのAPIを直接呼び出す形でコー
View webgl-sample.js
var utils;
(function (utils) {
/**
* 画像からピクセルカラー値を取得するユーティリティクラスです。
* @auther Kentaro Kawakatsu
*/
var ImageColorPicker = (function () {
function ImageColorPicker() {
}
ImageColorPicker.init = function ($canvas) {