This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + (BOOL)reflectTimestampSourcePath:(NSString *)sourcePath destPath:(NSString *)destPath | |
| { | |
| NSFileManager *fm = [NSFileManager defaultManager]; | |
| NSError *error = nil; | |
| // 1. ソースファイルのタイムスタンプを取得 | |
| NSDictionary *sourceAttrs = [fm attributesOfItemAtPath:sourcePath error:&error]; | |
| if (!sourceAttrs) { | |
| NSLog(@"Failed to get source attributes: %@", error); | |
| return NO; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + (NSDictionary *)dbstorejson:(NString *)filePath | |
| { | |
| NSError *fileError = nil; | |
| NSData *jsonData = [NSData dataWithContentsOfFile:filePath | |
| options:NSDataReadingMappedIfSafe | |
| error:&fileError]; | |
| if (!jsonData) { | |
| NSLog(@"ファイル読み込みエラー: %@", fileError); | |
| return nil; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + (NSString *)printableASCIIStringFromData:(NSData *)data { | |
| const unsigned char *bytes = data.bytes; | |
| NSMutableString *result = [NSMutableString string]; | |
| for (NSUInteger i = 0; i < data.length; i++) { | |
| unsigned char c = bytes[i]; | |
| // 表示可能 ASCII (0x20-0x7E) のみ許可 | |
| if (c >= 0x20 && c <= 0x7E) { | |
| [result appendFormat:@"%c", c]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import sympy as sym | |
| xs = np.arange(0, 10, 1E-2) | |
| xs[0] = 1E-7 | |
| x = sym.Symbol('x') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| import cv2 | |
| import numpy as np | |
| # ffmpeg -i input.mov -c copy input.mp4 | |
| cap = cv2.VideoCapture('input.mp4') | |
| fps = cap.get(cv2.CAP_PROP_FPS) | |
| width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) | |
| height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| OUTPUT="$1" | |
| shift | |
| if [ $# -eq 0 ] || [ "${OUTPUT}" == "-h" ] || [ "${OUTPUT}" == "--help" ]; then | |
| echo "ファイルが指定されていません" >&2 | |
| echo "使い方: ./merge.sh 出力.csv file1.csv file2.csv ..." >&2 | |
| echo "または ./merge.sh 出力.csv *.csv" >&2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| import torch | |
| import torch.nn.functional as F | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # ──────────────────────────────────────────────── | |
| # データ準備 | |
| # ──────────────────────────────────────────────── | |
| x_np = np.linspace(-4, 4, 401) # [-4, 4] の範囲で細かく |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| import torch | |
| import torch.nn.functional as F | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # ──────────────────────────────────────────────── | |
| # データ準備 | |
| # ──────────────────────────────────────────────── | |
| x_np = np.linspace(-4, 4, 401) # 細かくサンプリング |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import matplotlib.font_manager as fm | |
| import matplotlib | |
| prop = fm.FontProperties(fname='/System/Library/Fonts/ヒラギノ角ゴシック W3.ttc') | |
| prop.set_weight = 'normal' | |
| matplotlib.rcParams['font.family'] = prop.get_name() | |
| matplotlib.rcParams['font.weight'] = 'normal' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| import numpy as np | |
| from collections import Counter | |
| import matplotlib.pyplot as plt | |
| import matplotlib | |
| import matplotlib.font_manager as fm | |
| prop = fm.FontProperties(fname='/System/Library/Fonts/ヒラギノ角ゴシック W3.ttc') | |
| prop.set_weight = 'normal' | |
| matplotlib.rcParams['font.family'] = prop.get_name() |
NewerOlder