Skip to content

Instantly share code, notes, and snippets.

View tenomoto's full-sized avatar

Takeshi Enomoto tenomoto

View GitHub Profile
@tenomoto
tenomoto / settings.py
Last active December 23, 2018 02:25
add password reset to django admin
# use console backend for development
# https://docs.djangoproject.com/en/2.1/ref/settings/#std:setting-EMAIL_BACKEND
# https://docs.djangoproject.com/en/2.1/topics/email/#django.core.mail.backends.smtp.EmailBackend
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# use admin site to login
# https://docs.djangoproject.com/en/2.1/ref/settings/#std:setting-LOGIN_URL
LOGIN_URL = '/admin/'
@tenomoto
tenomoto / jrap_grib2nc.sh
Created November 9, 2018 03:32
Convert JMA Radar-AMeDAS in GRIB2 to netcdf
#!/bin/sh
yyyymmdd=20180701
hhmm=0000
fname=Z__C_RJTD_${yyyymmdd}${hhmm}00_RDR_JMAGPV__grib2
tar xf ${fname}.tar
wgrib2 ${fname%__grib2}_Ggis1km_Prr10lv_ANAL_grib2.bin -netcdf ${hhmm}.nc
@tenomoto
tenomoto / Animation.ipynb
Last active October 6, 2018 08:25
Animate pcolormesh and scatter
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tenomoto
tenomoto / add_read_permission.sh
Last active October 7, 2018 01:38
Add read permission to files and directories and execute only to directories
# a: all
# =: reset
# r: read
# X: execute excluding files
# u: user (owner)
# +: add
# w: write
chmod -R a=rX,u+w directory
@tenomoto
tenomoto / cpuinfo.sh
Created September 28, 2018 02:10
Processor information of Mac
# https://apple.stackexchange.com/questions/238777/how-do-i-identify-which-cpu-a-macbook-uses
sysctl -n machdep.cpu.brand_string
system_profiler SPHardwareDataType
@tenomoto
tenomoto / rotate.ncl
Last active January 9, 2023 01:20
Calculate tangential and radial winds by locating the typhoon centre at the North Pole
pi = acos(-1.0)
tau = 2 * pi
deg2rad = pi / 180.0
rad2deg = 180.0 / pi
procedure lonlat2xyz(lon, lat, x, y, z)
begin
x = cos(lon) * cos(lat)
y = sin(lon) * cos(lat)
z = sin(lat)
@tenomoto
tenomoto / .maintenance
Created December 24, 2017 05:22
Set WordPress into maintenance mode
<?php
// https://wordpress.stackexchange.com/questions/211303/wp-cli-enabling-maintainance-mode
$upgrading = time();
@tenomoto
tenomoto / read_automountdisk.sh
Created December 12, 2017 05:03
Examine if Mac mounts disks without user login
defaults read /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin
@tenomoto
tenomoto / mayavi_transparent_background.py
Created November 22, 2017 07:41
Mayavi transparent background
# https://stackoverflow.com/questions/23703417/can-mayavi-render-a-figure-scene-with-a-transparent-background
import numpy as np
from mayavi import mlab
import matplotlib.pyplot as plt
d = 3
n = 100
x = np.arange(-d, d, 2 * d / n)
y = np.arange(-d, d, 2 * d / n)