Skip to content

Instantly share code, notes, and snippets.

View nockn's full-sized avatar

dashi nockn

  • Japan
View GitHub Profile
@nockn
nockn / st_footer.py
Last active January 16, 2022 05:02
[how] Change the footer of Streamlit.
@nockn
nockn / st_rerun.py
Last active August 18, 2021 06:02 — forked from tvst/st_rerun.py
Rerun a Streamlit app from the top! See https://discuss.streamlit.io/t/update-sidebar/531
try:
from streamlit.ScriptRequestQueue import RerunData
from streamlit.ScriptRunner import RerunException
from streamlit.server.Server import Server
import streamlit.ReportThread as ReportThread
except:
from streamlit.script_request_queue import RerunData
from streamlit.script_runner import RerunException
from streamlit.server.server import Server
import streamlit.report_thread as ReportThread
@nockn
nockn / .gitignore
Created July 27, 2021 02:11
My gitignore
# macOS
### https://raw.github.com/github/gitignore/07c730e1fccfe0f92b29e039ba149d20bfb332e7/Global/macOS.gitignore
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
@nockn
nockn / convert_cv2pillow.py
Last active July 28, 2021 05:49
[note] How to convart from cv2image to pillowimage
import cv2
from PIL import Image
def conver_cv2pilimage(cvImage):
"""cv2(np.arry)の画像をpillowに変換する
Args:
cvImage(numpy.ndarray): OpenCVで読み込んだ画像
@nockn
nockn / empty_list.py
Created July 16, 2021 06:45
[note] How to generate an empty list
"""
空のリストを作るとき
方法によっては、いとあやふしらしい
https://qiita.com/shinhiro/items/ff3545d733c43ef462e0
"""
N = 114514
list = [[] for _ in range(N)]
@nockn
nockn / streamlit_layout.py
Created July 15, 2021 04:20
[note] layout options for Streamlit
import streamlit as st
st.header("Streamlit Layout Demo")
st.subheader("beta_columns, beta_container")
# https://blog.streamlit.io/introducing-new-layout-options-for-streamlit/
st.markdown("---")
# レイアウトの宣言
# カラム(横方向に分割)
column_left, column_right = st.beta_columns([2, 1])
@nockn
nockn / read_jsonc.py
Last active October 21, 2021 06:21
[note] How to load jsonc file
import json
import os
import re
from chardet.universaldetector import UniversalDetector
def get_text_encoding(file):
"""
ファイルの中身の文字コードを調べる