Skip to content

Instantly share code, notes, and snippets.

View nobucshirai's full-sized avatar

Nobu C. Shirai nobucshirai

View GitHub Profile
#!/bin/bash
file="$1"
name="${1%.pdb}"
Bfile="${name}-bb.pdb"
Mfile="m_$Bfile"
Mname="${Mfile%.pdb}"
bbq="java apps.BBQ"
scwrl="Scwrl4"
@nobucshirai
nobucshirai / project_namer.sh
Created April 4, 2014 12:34
sed-wrapper script for cafemol input and job files.
#!/bin/bash
N_TSTEP=1000000 # 1 day
JOB_PATH="${PWD%/*}"
main(){
os_check
check_options $@
file_name_def $@
dir_check
#!/bin/bash
DIR="JOB_OUTPUT"
main(){
ifdne_mkdir
for file in `ls`; do
err_count=`echo $file | grep -c "sh\.e"`
out_count=`echo $file | grep -c "sh\.o"`
if [[ $err_count > 0 || $out_count > 0 ]]; then
mv $file $DIR
fi
"------------------------------------------------
"表示関係
"------------------------------------------------
syntax on
"カラースキーマ
colorscheme desert
highlight fortranTab ctermfg=0
highlight fortranOperator ctermfg=5
highlight Number ctermfg=white
highlight LineNr ctermfg=white
# コマンドキーを Ctrl+T にする
escape ^Tt
# 起動時のライセンス画面を表示しない
startup_message off
# スクロールバックできる行数を2000行にする
defscrollback 2000
# ステータス行に表示するメッセージを10秒間表示する
# users generic .zshrc file for zsh(1)
# LANG
#
export LANG=ja_JP.UTF-8
case ${UID} in
0)
LANG=C
;;
esac
@nobucshirai
nobucshirai / ipm.py
Created October 19, 2018 08:15 — forked from mkakh/ipm.py
#!/usr/bin/env python
import sys
import json
from optparse import OptionParser
# loadJson :: String -> Dict
def loadJson(filePath):
with open(filePath, 'r') as f:
jsonDict = json.load(f)
return jsonDict
@nobucshirai
nobucshirai / 3d_line_intersection.py
Last active July 3, 2020 05:10
CALCULATE THE LENGTH OR SHORTEST LINE BETWEEN TWO LINES IN 3D
#!/usr/bin/env python3
#
# CALCULATE THE LENGTH OR SHORTEST LINE BETWEEN TWO LINES IN 3D
#
# See "The shortest line between two lines in 3D" of
# http://paulbourke.net/geometry/pointlineplane/ written by Paul Bourke
from optparse import OptionParser
import sys
import numpy as np
@nobucshirai
nobucshirai / chatgpt_json2md.py
Last active May 18, 2023 00:30
This Python script parses a JSON file, converts its content into Markdown format, and prints the result to the console. Use -h option for help.
#!/usr/bin/env python3
import json
import argparse
import datetime
def json_to_markdown(json_data):
markdown = ""
for document in json_data:
markdown += f"# {document['title']}\n\n"
@nobucshirai
nobucshirai / toggle_dir.py
Last active June 3, 2024 00:28
`toggle_dir.py` is a simple Python script that toggles between two specific directory structures: `src/` and `tests/`. It checks the current working directory and, if it is within a `src/` directory, it switches to the corresponding `tests/` directory and vice versa. The typical command: cd `toggle_dir.py`
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
def switch_directory():
current_path = os.getcwd()
base_dir = os.path.abspath(current_path)
if "src" in base_dir.split(os.sep):