@takane takane
takane
@takane takane / tasks.json Created at Thu Jan 15 12:20:53 JST 2026
macOSのVSCode用
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug (Clang/LLDB)",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"cwd": "${fileDirname}",
@takane takane / test Created at Tue Sep 17 09:07:59 JST 2024
test code
@takane takane / getImages.py Created at Thu Jun 27 11:39:19 JST 2024
# pip install icrawler

from icrawler.builtin import BingImageCrawler
crawler = BingImageCrawler(storage = {'root_dir' : './image/tflask'})
crawler.crawl(keyword = '三角フラスコ', max_num = 30)
crawler = BingImageCrawler(storage = {'root_dir' : './image/beaker'})
crawler.crawl(keyword = 'ビーカー', max_num = 30)
crawler = BingImageCrawler(storage = {'root_dir' : './image/funnel'})
crawler.crawl(keyword = 'ろうと', max_num = 30)
crawler = BingImageCrawler(storage = {'root_dir' : './image/burette'})
@takane takane / .zshrc Created at Wed Sep 06 11:59:58 JST 2023
Apple Siliconのマシンでhomebrewおよびpyenvを利用するときの設定ファイル (各自のホームディレクトリに作成) 。1行目から6行目はHomebrew用
if [ "$(uname -m)" = "arm64" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/opt/homebrew/bin:$PATH"
else
eval "$(/usr/local/bin/brew shellenv)"
fi

if [ "$(uname -m)" = "arm64" ]; then
# arm64
export PYENV_ROOT="$HOME/.pyenv_arm64"
@takane takane / createmltest.swift Created at Fri Jun 09 13:55:55 JST 2023
SwiftからCreateMLを実行するプログラム
// createmltest.swift
// Usage:
//      swift createmltest.swift <train folder path> <test folder path>
//
// reference:
// https://www.netguru.com/blog/createml-start-your-adventure-in-machine-learning-with-swift
//
// note:
// trainフォルダとtestフォルダをコマンドライン引数で指定
// mlmodelファイルをhomeのDesktopに書き込むように変更
@takane takane / style.css Created at Wed Jan 25 21:44:34 JST 2023
thesis用 図の挿入のCSS変更
body {
counter-reset: chapter;
font-family: "ヒラギノ明朝 ProN", "Hiragino Mincho ProN", serif;
}
p {
text-indent: 1em;
margin: 0 0 0.5em 1.5em;
text-align: justify;
text-justify: inter-ideograph;
}
@takane takane / maketoc.sh Created at Wed Jan 25 21:41:33 JST 2023
thesis用 参考文献と目次の見出しのバグ回避, サブセクション 10以上対応
#!/bin/bash
echo " <style> h2:before {content:none;}</style>

## 目次

<dl class=\"toc\">"
pdfgrep -n '(^第[0-9]章)|([0-9]{1,}\.){2,}|^参考|^謝辞|^付録' $1 |grep '^[0-9]*:[^ ]'|awk -F: '
{
if ($2 ~ /([0-9]{1,}\.){3}/) {
print "<div><dt class=\"depth-3\">",$2, "</dt><dd>",$1,"</dd></div>"
@takane takane / addpage.py Created at Thu Oct 27 22:04:42 JST 2022
PDFにページ番号付加
# addpage.py
#
#   PDFファイルにページ番号を追加
#
# 準備:
#   pip install reportlab pdfrw
#
# 使い方:
#   python addpage.py PDFファイル名
#
@takane takane / graph.py Created at Thu Oct 27 17:37:31 JST 2022
CreateML コマンドライン版の出力からAccuracyの表をグラフ化
import numpy as np
import matplotlib.pyplot as plt
import sys

args = sys.argv

# data01_axis1, data01_value1 = np.loadtxt(args[1], delimiter="|", usecols=range(1,3), unpack=True)
data01_axis1, data01_value1 = np.loadtxt(args[1], delimiter="|", usecols=[1,3], unpack=True)
data01_axis1, data02_value1 = np.loadtxt(args[1], delimiter="|", usecols=[1,4], unpack=True)
@takane takane / graph_turi.py Created at Fri Oct 14 22:11:08 JST 2022
matplotlibでturicreateのアウトプットのグラフ化
import numpy as np
import matplotlib.pyplot as plt

data01_axis1, data01_value1 = np.loadtxt("./kari2.txt", delimiter="|", usecols=range(1,3), unpack=True)

fig = plt.figure(figsize=(10, 6))
ax = fig.add_subplot(111)
ax.plot(data01_axis1, data01_value1, ".-", color="k", label="value1 of data01")
# ax.set_xlim(1000, 3000)
ax.set_xlabel("iterations")