Skip to content

Instantly share code, notes, and snippets.

View t-nissie's full-sized avatar

Takeshi Nishimatsu t-nissie

View GitHub Profile
@t-nissie
t-nissie / 00ODE.en.md
Last active November 13, 2016 11:56
Learn ordinary differential equation (ODE) solvers with a harmonic oscillator
@t-nissie
t-nissie / julia.ssh
Last active September 3, 2016 11:45
highlighting Julia code with a2p(1)
# Style sheet for julia
# Ref: https://groups.google.com/forum/#!topic/julia-users/tisM_9sKPCc
# Gist: https://gist.github.com/t-nissie/83174cab99b11a2b5fa075ad845e6b4f
##
style Julia is
written by "Takeshi Nishimatsu"
version is 0.0.1
first alphabet is
@t-nissie
t-nissie / 00Cr-bcc-AFM.md
Last active August 1, 2016 02:05
金属クロムの反強磁性状態をABINITで計算してみる

金属クロムの反強磁性状態をABINITで計算してみる

金属クロムの安定な磁気構造は spin density wave (SDW) とのことだが、 長周期構造を使うわけにもいかないときのために、反強磁性 (AFM) 状態 をbccの conventional unit cell で出してみる。

用意するファイル

3つのファイルを用意する。

  • bcc-AFM.files(下記)
@t-nissie
t-nissie / 00mruby.md
Created July 22, 2016 06:42
mrubyについてのメモ

mrubyについてのメモ

『まつもとゆきひろ直伝 組込Ruby「mruby」のすべて 総集編』を読みながら。

benchmark/bm_fib.rb

なんだかmrubyが速くない。

$ date
2016年 7月22日 金曜日 15時38分50秒 JST
$ cat benchmark/bm_fib.rb

def fib n

@t-nissie
t-nissie / fibonacci_number.rb
Last active April 9, 2024 10:23
Fibonacci number and Fibonacci word in Ruby (and Fortran)
#!/usr/bin/env ruby
# fib(n) generates n-th Fibonacci number
# Matirx#**(Integer) is implemented around
# ruby-2.3.0/lib/matrix.rb:1132:z = z ? z * x : x if other[0] == 1.
# Note that Integer#[] returns a bit.
# Author: Takeshi Nishimatsu
# Gist: https://gist.github.com/t-nissie/339adc257d067a9b926cea2c45f1754c
##
require 'matrix'
require 'benchmark'
@t-nissie
t-nissie / ToleranceFactorShannon.rb
Last active June 8, 2016 02:17
Tolerance factor calculator for ABX_3 perovskite structures with Shannon's ionic radii
#!/usr/bin/env ruby
=begin
= ToleranceFactorShannon.rb
Tolerance factor calculator for ABX_3 perovskite structures
== Source code at Gist
https://gist.github.com/t-nissie/2cf277328b9598e090f890f1bd55f57b
== Perovskite structure
The ABX_3 perovskite structure has
an ion A at the 12-coordinate a1 site,
an ion B at the 6-coordinate b1 site, and
@t-nissie
t-nissie / Ruby-TEST_COLORS.md
Last active May 11, 2016 23:08
RubyにおてTEST_COLORS環境変数を適宜設定すると、configureの途中経過が見やすくなる件

RubyにおけるTEST_COLORS環境変数

RubyにおけるTEST_COLORS環境変数についてのドキュメントがさっぱり見つからなかったので MacのiTerm 2上でいろいろ試してみた。

configure

Version 2.3以上のRubyのソースを./configureした場合、{yes, no, その他} に色が付く。 しかし背景が白いターミナル画面を使っていると明るい黄色の文字が見づらいことがある。 そのとき

@t-nissie
t-nissie / wall_clock.f
Last active November 16, 2016 09:51
Example of MPI_Barrier() and MPI_Wtime() in Fortran
! wall_clock.f -*-f90-*-
! Gist: https://gist.github.com/t-nissie/e317fd796d4b885106139f752ee4300d
!!
program wall_clock
implicit none
include 'mpif.h'
integer i_error, mpi_my_rank
real*8 start, finish
call MPI_INIT(i_error)
call MPI_COMM_RANK(MPI_COMM_WORLD, mpi_my_rank, i_error)
@t-nissie
t-nissie / zundoko.gp
Last active March 18, 2016 05:43
ズンドコキヨシ in GNUPLOT(関数にするのは難しそう)
# zundoko.gp
#「ズン」「ドコ」のいずれかをランダムで出力し続けて
#「ズン」「ズン」「ズン」「ズン」「ドコ」の配列が出たら
#「キ・ヨ・シ!」って出力した後終了
# Author: Takeshi Nishimatsu
# Gist: https://gist.github.com/t-nissie/f4e9a58641f6747ff929
# Ref1: https://twitter.com/kumiromilk/status/707437861881180160
# Ref2: http://qiita.com/shunsugai@github/items/971a15461de29563bf90
# Usage: 擬似乱数の種となる整数や整数を返す関数を引数としてcallします。
# $ gnuplot # gnuplotをインタラクティブモードで起動
@t-nissie
t-nissie / 10physics.md
Last active March 31, 2016 09:21
領域運営委員の仕事

領域運営委員の仕事

4/22 シンポジウム提案

4/22 インフォーマルミィーティング予約

9/30 homepageの引き継ぎ