Skip to content

Instantly share code, notes, and snippets.

@lamsh
lamsh / is_main.js
Created August 19, 2016 16:07
Python "if __main__" in Node.js and WSH JScript
/****************************************************************************
\file is_main.js
\author SENOO, Ken
\copyright CC0
*****************************************************************************/
function is_main(this_file_name){
return (typeof(module ) !== "undefined" && !module.parent ) ||
(typeof(WScript) !== "undefined" && WScript.ScriptName === this_file_name)
}
@lamsh
lamsh / print.js
Last active August 19, 2016 14:33
Wrapper function for display text on JavaScript, JScript, SpiderMonkey.
/****************************************************************************
\file print.js
\author SENOO, Ken
\copyright CC0
\date first created date: 2016-08-14T15:43+09:00
\date last updated date: 2016-08-14T17:14+09:00
****************************************************************************/
/**
\brief Wrapper function for display text on JavaScript, JScript, SpiderMonkey.
@lamsh
lamsh / loop-time.sh
Last active July 1, 2016 13:29
シェルスクリプトでの列フィールド取得方法の実行速度の比較(http://myfuturesightforpast.blogspot.jp/2016/07/how-to-extract-column-field-in-shell.html
#!/bin/sh
# \file loop-time.sh
# \author SENOO, Ken
# \copyright CC0
set -u
DATA="loop-data.dat"
: > $DATA
for i in $(seq 1 50000)
do
@lamsh
lamsh / ALID2FLIPGEN.js
Created July 1, 2016 11:26
AFIMEXのメッシュをFLIPGENで読み込めるメッシュにする。
/****************************************************************************
\file ALID2FLIPGEN.js
\author SENOO, Ken
\copyright CC0
\date created date: 2016-01-29T16:31+09:00
\date updated date: 2016-02-18T13:24+09:00
****************************************************************************/
/**
\brief AFIMEXのメッシュをFLIPGENで読み込めるメッシュにする
@lamsh
lamsh / extract_ES_output.js
Last active July 1, 2016 11:31
構造解析ソフトEngineer's Studioの計算結果の出力CSVファイルから必要な値を抽出するJScript
/****************************************************************************
\file last_step_extract_ES_output.js
\author SENOO, Ken
\copyright CC0
\date created date: 2015-12-14T21:46+09:00
\date updated date: 2016-02-16T17:43+09:00
****************************************************************************/
/**
E.Sの計算結果をCSVで出力したものから、要素ごとにN、SYP、MZPの最大絶対値をCSVで抽出する。
@lamsh
lamsh / text_file_io.c
Last active November 30, 2015 16:30
C言語でのテキストファイル入出力の基本パターン
/*! \file text_file_io.c
* \author SENOO, Ken
* \copyright CC0
* \date 2015-12-01T01:30+09:00
****************************************************************************/
/*! \brief プログラムの概要
C言語でテキストファイル処理として頻出の以下の動作のサンプルである。
1. テキストファイルを文字列として一括で読み込む。
2. 文字列を改行で区切って配列に格納。
#!/bin/bash
# \file message-1tex.sh
# \author SENOO, Ken
# \license CC0
# URL: <http://d.hatena.ne.jp/zrbabbler/20151111/1447227230>
# \brief try ez1tex.
wget -nc https://gist.githubusercontent.com/zr-tex8r/8025bf712798707e32f5/raw/3f9e8471e1fbec540fd2221c44d65339c61b24da/message.txt
sed -i.backup 's/[^1]//g' message.txt
@lamsh
lamsh / YAHHO.F
Created August 2, 2015 08:18
YAHHO.F
C YAHHO.F
10 CONTINUE
PRINT*, "ヤッホー,フォートランランラン!"
GOTO 10
PRINT*, "ヤホホ"
END
@lamsh
lamsh / paring.py
Last active August 29, 2015 14:25
#!/usr/bin/env python3
# coding: utf-8
# (File name: paring.py)
# Author: SENOO, Ken
# License: CC0
# (Last update: 2015-07-26T20:32+09:00)
import itertools
FR = "./項目リスト.txt"
backgroundcolor={\color[gray]{0.9}}
basicstyle={\ttfamily\scriptsize}
breakindent=0pt
breaklines=true
commentstyle={\textit}
escapechar={@_}
frame=single
frameround=ffff
framesep=5pt
keywordstyle={\textbf}