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 / crd2enex.cpp
Last active August 29, 2015 13:57
crd2enex: cardfile (.crd file of Windows 3.1) to Evernote export format (.enex) converter
// crd2enex.cpp
// Description: cardfile (.crd file of Windows 3.1) to Evernote export format (.enex) converter
// Copyright (C) 2014,2015 Takeshi Nishimatsu
// Gist: https://gist.github.com/t-nissie/9771048
// Compile: g++ -Wall -g -o crd2enex crd2enex.cpp
// Usage: ./crd2enex English.crd > English.enex
// ./crd2enex Japanese.crd | nkf -S -w > Japanese.enex
// Bug: If a card has <> or [] in its text, its converted note will be irregular.
// You can find the irregularity by synchronization failure of the note.
// Please fix the irregular note manually.
@t-nissie
t-nissie / histogram.gp
Last active August 29, 2015 14:01
Draw a histogram with GNUPLOT, or a bug in feram-0.22.03.tar.xz (See histogram.jpg below)
#!/usr/bin/env gnuplot
# histogram.gp
# Time-stamp: <2014-05-21 11:50:24 takeshi>
# Author: Takeshi NISHIMATSU
# Gist: https://gist.github.com/t-nissie/24cc524481474bb497c5
##
set terminal postscript portrait color dashed "Times-Roman" 20
set output "histogram.eps"
set ylabel 'count'
bin(x,width)=width*floor(x/width)+width/2
@t-nissie
t-nissie / 00GNUPLOT_with_serial_evaluation.md
Last active August 29, 2015 14:01
GNUPLOTのserial evaluationを使う

GNUPLOTのserial evaluationを使う

“Serial evaluation occurs only in parentheses and is guaranteed to proceed in left to right order. The value of the rightmost subexpression is returned. (GNUPLOTのhelp operator binaryより)” 例えば、(y=$3<10 ? $3 : lasty, lasty=$3, y)。 以下のsample.gpでは1つ前の値をlastyに取っておいて、ノイズを消すのに使っている。 データの簡単な微分に使うこともできる→ http://www.ss.scphys.kyoto-u.ac.jp/person/yonezawa/contents/program/gnuplot/diff_data1.html

@t-nissie
t-nissie / 00Fortran_system_clock.md
Last active August 29, 2015 14:03
COUNT_RATE and COUNT_MAX of SYSTEM_CLOCK() in Fortran

COUNT_RATE and COUNT_MAX of SYSTEM_CLOCK() in Fortran

In Fortran, SYSTEM_CLOCK() internal subroutine is commonly used for timing. However, on some platforms, it is difficult to measure a time interval longer than one day, bucause the counter is reset once a day.

Here is a list of COUNT_RATE and COUNT_MAX from CALL SYSTEM_CLOCK(COUNT, COUNT_RATE, COUNT_MAX) on various platforms.

@t-nissie
t-nissie / 00next_float.md
Last active August 29, 2015 14:06
ある浮動小数点数のとなりの浮動小数点数〜Ruby 2.2のFloat#next_float, Float#prev_floatとFortran 2003のieee_next_after(x,y)〜

ある浮動小数点数のとなりの浮動小数点数

2014年末にリリースのRuby 2.2にはFloat#next_float, Float#prev_floatという機能が新しく追加される。 浮動小数点演算の精度保証などに用途があるらしい。試してみる。

なおIEEE標準の倍精度浮動小数点数は 1ビットの符号ビットと53ビットの有効数字 (significand) と11ビット幅の指数部を持つ。 隠れビット (hidden bit) があるから、合計で1+53+11-1=64ビット幅になっている。 有効数字は10進数ならlog10253=53log102=15.95…だから、16桁程度である。

@t-nissie
t-nissie / rubyforge2github.md
Last active August 29, 2015 14:13
RubyForgeのSubversionレポジトリからGitHubへの引越

RubyForgeのSubversionレポジトリからGitHubへの引越

RubyForge.orgがサービスを縮小させつつあるので、 そのSubversionレポジトリをGitHubに移動させる。 ssh-keyは双方について適宜設定されているものとする。

もっと冴えたやりかた等、ご意見募集中。

参考文献

@t-nissie
t-nissie / is_power2.f
Last active August 29, 2015 14:24
Fortran: is_power2(a) returns .true. if a is power of 2, i.e. a==2**n.
! is_power2.f -*-f90-*-
! is_power2(a) returns .true. if a is power of 2, i.e. a==2**n.
! Author: Takeshi Nishimatsu
!!
logical function is_power2(a)
implicit none
integer, intent(in) :: a
integer :: x
x = a
if (x<=0) then
@t-nissie
t-nissie / FeramGettingStarted.en.md
Last active October 13, 2015 03:22
MateriApps LIVE!をUSBメモリから起動し、強誘電体用高速分子動力学シミュレーターferamを試用する方法を説明しています
@t-nissie
t-nissie / 00Miyagi.md
Last active October 28, 2015 13:33
宮城県で必ず訪れたい観光地

宮城県で必ず訪れたい観光地

太白区

  • 太白山
  • 釜房湖
  • 湖畔公園
  • 八木山動物公園(ベーブルース像)

登米

  • 佐沼城と隣の博物館
@t-nissie
t-nissie / spinpump.F
Last active November 12, 2015 07:38
Fu-Kane Spin Pump
! spinpump.F -*-f90-*-
! Fu-Kane spin pump
! Shun-Qing Shen: "Topological Insulators: Dirac Equation in Condensed Matters"
! (Springer Series in Solid-State Sciences, 2013) Section 4.6
! Liang Fu and C. L. Kane: "Time reversal polarization and a Z_2 adiabatic spin pump",
! Phys. Rev. B 74, 195312 (2006).
! Time-stamp: <2015-10-07 17:00:57 takeshi>
! Author: Takeshi NISHIMATSU
! Gist: https://gist.github.com/t-nissie/98aeb84ed30467aa24b7
! Clone: git clone git@gist.github.com:98aeb84ed30467aa24b7.git 04.6.Fu-Kane-spin-pump