Skip to content

Instantly share code, notes, and snippets.

View mintisan's full-sized avatar

Jinhui.Lin mintisan

View GitHub Profile
@mintisan
mintisan / file_name_prefix_add.py
Last active June 25, 2016 06:38
add a specific prefix for all files within current directory
#-*- coding: utf-8 -*-
import os
import numpy as np
import walkdir as wd
prefix = 'pre-'
file_info_type = np.dtype({
'names': ['dir','name'],
@mintisan
mintisan / file_name_strip_modify.py
Created June 25, 2016 06:39
modify split in file_name
#-*- coding: utf-8 -*-
import os
import numpy as np
import walkdir as wd
file_info_type = np.dtype({
'names': ['dir','name'],
'formats':['S100','S100']
})
@mintisan
mintisan / file_name_suffix_modify.py
Created June 25, 2016 07:04
modify file's suffix
#-*- coding: utf-8 -*-
import os
import numpy as np
import walkdir as wd
file_info_type = np.dtype({
'names': ['dir','name'],
'formats':['S100','S100']
})
@mintisan
mintisan / file_name_modify.py
Last active June 25, 2016 07:54
modify file name: prefix, suffix, split and specific keywords
#-*- coding: utf-8 -*-
import os
import numpy as np
import walkdir as wd
file_info_type = np.dtype({
'names': ['dir','name'],
'formats':['S100','S100']
})
@mintisan
mintisan / bmp2raw.py
Created August 4, 2016 11:53
convert all bmp(or png, jpg) image in current direcory recursively to raw image Raw
# -*- coding: utf-8 -*-
# @author linjinhui
# @time 2016/08/04
# @version 1.0
import numpy as np
from PIL import Image
import os
import re
from tqdm import tqdm
@mintisan
mintisan / raw2bmp.py
Created August 4, 2016 11:54
convert all raw images in current directory recursively to bmp(or png/jpg) image files
# -*- coding: utf-8 -*-
# @author linjinhui
# @time 2016/04/01
# @version 1.0
# How can I save an image with PIL?
# http://stackoverflow.com/questions/14452824/how-can-i-save-an-image-with-pil
import numpy as np
from PIL import Image
import os
import re
@mintisan
mintisan / raw2bmp.m
Created August 6, 2016 11:22
read a raw image, convert to bmp image format
fp = fopen('0016.raw','r');
[a,count]=fread(fp);
a = reshape(a,row,col)';
figure,imshow(uint8(a))
imwrite(uint8(a),'0016.bmp','bmp');
@mintisan
mintisan / copy_bin_2_nucleo.py
Last active August 28, 2016 07:29
copy bin from Downloads directory to board(like Nucleo) automatically for mbed
import os
from shutil import copyfile
# `sudo pip install walkdir` if you don't install walkdir
import walkdir as wd
import time
src_dir = os.environ['HOME']+'/Downloads/'
dst_dir = '/Volumes/NUCLEO/'
pattern = "*_NUCLEO_F401RE.bin"
@mintisan
mintisan / Makefile
Last active December 2, 2016 10:48
Mikefile demo for MSP430-GCC
# Project Structure
# [D]src: all source files here
# [D]inc: all headers
# [D]obj: objects, binary, out
# [F]makefile
# [D]: derectory
# [F]: file
# Note:no need to add include directory in any header or source file
vpath %.h inc
@mintisan
mintisan / tensorflow_pip_setup.md
Last active December 10, 2016 10:33
tensorflow pip setup on macOS