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 / delxattr.py
Last active June 6, 2016 02:37
Mac OS Xとかでファイルとディレクトリの拡張属性xattrを再帰的にすべて消す高速なPythonスクリプトdelxattr.py
#!/usr/bin/env python
# delxattr.py recursively removes all extended attributes (xattr) from
# all files and directories under the current or given directory.
# In the latest Mac OS X, you can do the same thing with "xattr -rc".
# See a help of xattr with "xattr -h".
# Author: Takeshi NISHIMATSU
# Gist: https://gist.github.com/t-nissie/8491009
# Example1$ delxattr.py
# Example2$ delxattr.py ../foo
# Example3$ delxattr.py ~/foo
@t-nissie
t-nissie / gnuplot-safari-emacs.sh
Created March 14, 2014 02:09
Mac OS Xで、SafariでプレビューしながらEmacsでSVGを出力するGNUPLOT scriptを編集⇄実行するのに便利なシェルスクリプトgnuplot-safari-emacs.sh
#!/bin/sh
# gnuplot-safari-emacs.sh
# Edit and execute a GNUPLOT script on Emacs
# while previewing an SVG file with Safari on Mac OS X.
# Author: Takeshi NISHIMATSU
# Gist: https://gist.github.com/t-nissie/
# Usage:
# (1) Put this gnuplot-safari-emacs.sh in /usr/local/bin/.
# (2) Add following 3 lines at the end of your GNUPLOT script foo.gp.
# #Local variables:
@t-nissie
t-nissie / Gudermannian-erf-tanh-Langevin.md
Last active March 12, 2021 08:08
ゼロ近傍で傾きを持ち、±∞で±1か±π/2になる関数

ゼロ近傍で傾きを持ち、±∞で±1か±π/2になる関数

ゼロ近傍で傾きを持ち、x→±∞ で f(x) → ±1 or ±π/2 になる関数、ようするに図1の5つの関数を集めてみた。

figure1

図1: グーデルマン関数 gd(x)、誤差関数 erf(x)、tanh(x)、ランジュバン関数 L(x)

グーデルマン関数

@t-nissie
t-nissie / HowToGist.md
Last active May 25, 2024 13:39
Gistの使い方のメモ

Gistの使い方のメモ

Gistを使い始めて気がついた点をメモした。 Gistはこのようなメモや短いコードをバージョン管理しながら公開するのに便利。

特にこのメモでは、画像を同一ディレクトリに置いて、 それGFMファイル内に挿入する方法を解説。

このメモにはgitコマンドの使い方の解説はない。 このメモは随時更新される予定。

@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 / 00triangle_wave.md
Last active January 3, 2016 14:56
三角波を生成する方法

三角波を生成する方法

周期T三角波を生成するにはabs(mod(i,T)-T/2)-T/4とする。 ここで、i=0,1,2,3,...。 また、Tは4の倍数である必要がある。

この文章は Gist https://gist.github.com/t-nissie/0325fc29d833e0aa6f4d に置いてある。 git clone https://gist.github.com/0325fc29d833e0aa6f4d.git triangle_waveもしくは git clone git@gist.github.com:0325fc29d833e0aa6f4d.git triangle_waveでクローンできる。

@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 / gfm2html.md
Last active February 22, 2017 20:16
手もとでGFMファイルをHTMLファイルに変換する簡単なRubyスクリプトgfm2html.rb

gfm2html.rb

手もとでGFM (GitHub Flavored Markdown) ファイルをHTMLファイルに変換する簡単なRubyスクリプトgfm2html.rbを下に置きました。 github-markdownを用いています。 google-code-prettifyを使えばsyntax highlightができることが特徴です。 簡単なCSSファイルを用意して使います。例としてstyle.cssが下に置いてあります。

この文章は Gist https://gist.github.com/t-nissie/c415b7da3a694e82d6b5 に置いてあります。 git clone https://gist.github.com/c415b7da3a694e82d6b5.git gfm2htmlでクローンできます。