Skip to content

Instantly share code, notes, and snippets.

View treastrain's full-sized avatar
🏠
Learning at home

treastrain / Tanaka Ryoga treastrain

🏠
Learning at home
View GitHub Profile
@treastrain
treastrain / Makefile
Last active June 14, 2023 11:59
✅ A C++ project using OpenCV that can be compiled with Clang but not with GCC
OpenCV-Playground:
echo OpenCV-Playground
buildclang:
clang++ -Wall -std=c++17 -O0 \
-I../Libraries/opencv/include/opencv4 -L../Libraries/opencv/lib \
-lopencv_core -lopencv_videoio -lopencv_imgproc -lopencv_imgcodecs \
-o OpenCV-Playground \
main.cpp
@treastrain
treastrain / ContentView.swift
Last active March 3, 2021 08:15
【SwiftUI & Kronos】NTP から時刻を取得し端末の設定によらず正しい Date を得る
//
// ContentView.swift
// Shared
//
// Created by treastrain on 2021/03/03.
//
import SwiftUI
import Kronos
@treastrain
treastrain / Task :shared:linkDebugFrameworkIosX64 FAILED
Last active March 20, 2021 13:35
Task :shared:linkDebugFrameworkIosX64 FAILED
Command line invocation:
/Applications/Xcode-12.5.0-Beta.3.app/Contents/Developer/usr/bin/xcodebuild -project /Users/treastrain/AndroidStudioProjects/MyKMMApplication/./iosApp/iosApp.xcodeproj -scheme iosApp OBJROOT=/Users/treastrain/AndroidStudioProjects/MyKMMApplication/build/ios SYMROOT=/Users/treastrain/AndroidStudioProjects/MyKMMApplication/build/ios -sdk iphoneos -arch arm64
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
ARCHS = arm64
OBJROOT = /Users/treastrain/AndroidStudioProjects/MyKMMApplication/build/ios
SDKROOT = iphoneos14.5
@treastrain
treastrain / Task :shared:linkDebugFrameworkIosArm64 FAILED
Last active March 20, 2021 09:54
Task :shared:linkDebugFrameworkIosArm64 FAILED
Command line invocation:
/Applications/Xcode-12.5.0-Beta.3.app/Contents/Developer/usr/bin/xcodebuild -project /Users/treastrain/AndroidStudioProjects/MyKMMApplication/./iosApp/iosApp.xcodeproj -scheme iosApp OBJROOT=/Users/treastrain/AndroidStudioProjects/MyKMMApplication/build/ios SYMROOT=/Users/treastrain/AndroidStudioProjects/MyKMMApplication/build/ios -sdk iphoneos -arch arm64
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
ARCHS = arm64
OBJROOT = /Users/treastrain/AndroidStudioProjects/MyKMMApplication/build/ios
SDKROOT = iphoneos14.5
@treastrain
treastrain / AuthenticationByTouchIDWithMacOSCommandLineTool.swift
Created March 26, 2021 09:59
macOS Command Line Tool で Local Authentication を使って MacBook Pro の Touch ID で認証する Swift プログラム
//
// AuthenticationByTouchIDWithMacOSCommandLineTool.swift
//
//
// Created by treastrain on 2021/03/26.
//
import LocalAuthentication
let context = LAContext()
@treastrain
treastrain / JapaneseTraditionalDiceGame.swift
Created July 16, 2021 20:24
あの日本語非対応で有名な JapaneseTraditionalDiceGame を Swift で書いてみた( https://ja.wikipedia.org/wiki/NKODICE
import Foundation
struct Dice {
private let characters = ["う", "お", "こ", "ち", "ま", "ん"].sorted()
func roll() -> String? {
return Int.random(in: 0..<5) == 0 ? nil : characters.shuffled().first
}
}
@treastrain
treastrain / ConcurrencyNFCApp.swift
Created August 27, 2021 20:45
SwiftUI App + Core NFC + Swift Concurrency を使って書いた、交通系電子マネーカードの残高読み取りサンプル。 https://twitter.com/treastrain/status/1431356306963587072
//
// ConcurrencyNFCApp.swift
// ConcurrencyNFC
//
// Created by treastrain on 2021/08/28.
//
import SwiftUI
import CoreNFC
//
// main.swift
//
// Created by treastrain / Tanaka Ryoga on 2021/09/12.
//
// These codes are licensed under CC0.
// https://creativecommons.org/publicdomain/zero/1.0/deed
//
import Foundation
@treastrain
treastrain / NetworkPlaygroundApp.swift
Last active January 24, 2025 06:08
NWPathMonitor のサンプル
//
// NetworkPlaygroundApp.swift
// NetworkPlayground
//
// Created by treastrain / Tanaka Ryoga on 2021/09/28.
//
import SwiftUI
import Network
@treastrain
treastrain / CopyTitleAndURL.applescript
Created November 18, 2021 14:22
Web ページのタイトルと URL をクリップボードにコピーする
on run {input, parameters}
tell application "System Events"
set front_app to name of (path to frontmost application)
end tell
-- display notification front_app with title "Running applications"
if front_app is "Safari.app" then
tell application "Safari"
set theURL to URL of front document