Skip to content

Instantly share code, notes, and snippets.

View mitsuhisaT's full-sized avatar

Mitsuhisa Tanaka mitsuhisaT

View GitHub Profile
@mitsuhisaT
mitsuhisaT / githubrepos.txt
Created June 15, 2020 22:46
Syncing multiple upstream bash scripts.
Aerial master
Pi_Servo_Hat master
RPi_Cam_Web_Interface master
RPi_PanTilt_Camera_Kit master
tensorflow/docs-l10n master
covid19 development
covid19-saitama development
aiyprojects-raspbian aiyprojects
@mitsuhisaT
mitsuhisaT / rename_directories.py
Created March 24, 2020 12:54
rename many directories by Python via Regular expression and Pathlib.
#! /usr/bin/env python3
import os
import re
from pathlib import Path
for dn, dps, fns in os.walk('.'):
if re.search(r'\./.+_\d{8}', dn) is not None:
# rename to 20200324_test from test_20200324
Path(dn).rename(Path(re.sub(r'(\./)(.+)_(\d{8})', r'\1\3_\2', dn)))
@mitsuhisaT
mitsuhisaT / for-Django3-upgrade.md
Created December 3, 2019 23:31
How to modify Bootstrap4 sass in Django 3.0.

How to use Bootstrap4 Sass in Django 3.0

I set up Django 2.2 and Bootstrap4 Sass from the
['How to use SCSS/SASS in your Django project (Python Way)'][dbs].

But can't work Django 3.0.
This is one of resolution.

My testing environment is:
macOS High Sierra Version 10.13.6

@mitsuhisaT
mitsuhisaT / august-temperature.csv
Created September 25, 2019 13:21
CSV august temperature from 1901 to 2018
年月日 平均気温(℃) 品質情報 均質番号 最高気温(℃) 品質情報 均質番号 最低気温(℃) 品質情報 均質番号
'1901-08-01' 27.0 8 1 32.1 8 1 21.8 8 1
'1901-08-02' 27.0 8 1 32.5 8 1 23.3 8 1
'1901-08-03' 27.1 8 1 32.3 8 1 23.4 8 1
'1901-08-04' 28.2 8 1 33.8 8 1 23.0 8 1
'1901-08-05' 28.8 8 1 35.6 8 1 23.7 8 1
'1901-08-06' 27.7 8 1 34.9 8 1 23.9 8 1
'1901-08-07' 21.2 8 1 25.2 8 1 18.4 8 1
'1901-08-08' 19.4 8 1 22.2 8 1 17.3 8 1
'1901-08-09' 19.8 8 1 24.4 8 1 16.2 8 1
@mitsuhisaT
mitsuhisaT / sample-running_mean-temperature.py
Created September 17, 2019 23:33
sample running mean temperature used numpy.convolve()
#!/usr/bin/env python
"""Draw line graph of 118 years August temperature line graph.
Past data of temperature gets from
https://www.data.jma.go.jp/gmd/risk/obsdl/index.php
Sample original data
2018,8,8,30.3,8,2,35.1,8,2,24.8,8,2
2018,8,9,31.2,8,2,37.3,8,2,26.7,8,2
@mitsuhisaT
mitsuhisaT / sample-max-temperature.py
Last active September 10, 2019 23:29
How to calculate mean using numpy.mean via numpy.ndarray.
#!/usr/bin/env python
"""Draw line graph of 118 years August temperature line graph.
Past data of temperature gets from
https://www.data.jma.go.jp/gmd/risk/obsdl/index.php
Sample original data
2018,8,8,30.3,8,2,35.1,8,2,24.8,8,2
2018,8,9,31.2,8,2,37.3,8,2,26.7,8,2
@mitsuhisaT
mitsuhisaT / mean-temperature-graph_all.py
Created September 1, 2019 23:37
about use converters matplotlib.dates.datestr2num in numpy.loadtxt
#!/usr/bin/env python
"""Draw line graph of 118 years August temperature line graph.
Past data of temperature gets from
https://www.data.jma.go.jp/gmd/risk/obsdl/index.php
Sample original data
2018,8,8,30.3,8,2,35.1,8,2,24.8,8,2
2018,8,9,31.2,8,2,37.3,8,2,26.7,8,2
@mitsuhisaT
mitsuhisaT / play_radiko.sh
Created August 25, 2019 12:41
only play radiko, bash script on macOS and Linux include Raspbian
#!/bin/bash
# delete RECORD mode, only PLAY mode
# If you need 'record mode', you can get from
# https://mtunn.wordpress.com/2017/02/08/raspberrypi3%e3%81%a7radiko/
pid=$$
wkdir='/var/tmp'
playerurl=http://radiko.jp/apps/js/flash/myplayer-release.swf
playerfile="${wkdir}/player.swf"