Skip to content

Instantly share code, notes, and snippets.

Avatar
🕊️
pigeoning

Pigeon p-geon

🕊️
pigeoning
View GitHub Profile
View python_print_with_color.py
! pip install -q termcolor==1.1.0
from termcolor import colored
print(colored('hello', 'red'), colored('world', 'green'))
print(colored("hello red world", 'red'))
# ---
red = "\x1b[31m"
red_ = "\x1b[0m"
print(f"{red}red{red_}a")
View .zprofile
echo "[loading] ~/.zprofile"
# =========================================
## hook command: cd -> cd + ls
cdls ()
{
\cd "$@" && ls
}
View .zshrc
# 色を使用
autoload -Uz colors
colors
# scp needs locate this
echo "[loading] ~/.zshrc"
# 補完
# autoload -Uz compinit
# compinit
View imshow.py
from skimage import io
import matplotlib.pyplot as plt
def imshow(img, dpi=150):
if(len(img.shape)==2):#grayscale
plt.figure(dpi)
plt.imshow(img)
plt.gray()
plt.show()
else:
View unet.py
def unet(x, ch, depth, cut_path=False):
conv_kwargs = {'kernel_size': (3, 3), 'strides'=(1, 1), 'dilation_rate'=(1, 1),
'padding'='same', 'use_bias'=True, 'bias_initializer'='zeros', 'kernel_initializer'='he_normal'}
for _ in range(2):
x = tf.keras.layers.Convolution2D(ch, **conv_kwargs)(x)
x = tf.keras.layers.BatchNormalization()(x)
x = tf.keras.layers.Activation('relu')(x)
if(depth != 0):
path = x
View directory_initializer.sh
touch Makefile
touch Dockerfile
touch .gitignore
touch .dockerignore
touch requirements.txt
# gigignore
echo '.ipynb_checkoints' >> .gitignore
echo '__pycache__' >> .gitignore
@p-geon
p-geon / python_utils.py
Last active May 14, 2021
python useful snippets
View python_utils.py
# for docker inside, "ls ./ && ls ../"
import os; print(os.listdir('./'), os.listdir('../'))
# =====
# images
# =====
'''read tif'''
!pip install tifffile==2020.9.3
import tifffile
tifffile.imread('filename.tif')
View tf-flower-dataset.py
import tensorflow as tf
AUTOTUNE = tf.data.experimental.AUTOTUNE
import pathlib
import random
import os
import IPython.display as display
import matplotlib.pyplot as plt
@p-geon
p-geon / Makefile
Last active Feb 23, 2021
Docker+LaTeX
View Makefile
export PWD=`pwd`
export DIR=.
export FILENAME=main
# ===========================================
en: ## compile LaTeX with English
@make tex CONTAINER=pman0214/alpine-texlive-ja-epspdf
@make aux CONTAINER=pman0214/alpine-texlive-ja-epspdf
@make tex CONTAINER=pman0214/alpine-texlive-ja-epspdf
@make tex CONTAINER=pman0214/alpine-texlive-ja-epspdf
@make dvi CONTAINER=pman0214/alpine-texlive-ja-epspdf
@p-geon
p-geon / Makefile
Last active Feb 23, 2021
GeneralPurpose for CC-56 Blog
View Makefile
## ENVs
# basic
export PWD=`pwd`
# docker
export CONTAINER_NAME=container_name
export DIR_DOCKER=docker
export DOCKERFILE_NAME=Dockerfile
export EXPOSED_PORT=8888
export CONTAINER_ID=`docker ps --format {{.ID}}`
# --------------------------------------------------------