Skip to content

Instantly share code, notes, and snippets.

View sonsongithub's full-sized avatar

Yuichi Yoshida sonsongithub

View GitHub Profile
@sonsongithub
sonsongithub / canvas.py.patch
Created November 15, 2024 06:42
Avoid labelImg from crashing when creating annotaion
--- canvas.original.py 2024-11-09 01:08:48
+++ canvas.py 2024-11-09 01:09:31
@@ -523,12 +523,12 @@
p.setPen(self.drawing_rect_color)
brush = QBrush(Qt.BDiagPattern)
p.setBrush(brush)
- p.drawRect(left_top.x(), left_top.y(), rect_width, rect_height)
+ p.drawRect(int(left_top.x()), int(left_top.y()), int(rect_width), int(rect_height))
if self.drawing() and not self.prev_point.isNull() and not self.out_of_pixmap(self.prev_point):
@sonsongithub
sonsongithub / applescript.swift
Last active October 4, 2024 13:18
AppleScript handler
import Cocoa
protocol CreatableFromNSAppleEventDescriptor {
static func get(a:NSAppleEventDescriptor) throws -> Self
}
extension Int : CreatableFromNSAppleEventDescriptor {
static func get(a:NSAppleEventDescriptor) throws -> Self {
return Int(a.int32Value)
@sonsongithub
sonsongithub / fft.ipynb
Last active January 17, 2024 05:15
FFTのおさらいメモ
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/*
* vdsp_int2float.c
* AccelerateTest
*
* Created by sonson on 10/08/15.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include "lapack_linearEquation.h"
@sonsongithub
sonsongithub / IconPlayground.playground
Created October 13, 2023 06:35
Swift Playground for creating an icon.
//: A Cocoa based Playground to present user interface
import AppKit
import PlaygroundSupport
let nibFile = NSNib.Name("MyView")
var topLevelObjects : NSArray?
Bundle.main.loadNibNamed(nibFile, owner:nil, topLevelObjects: &topLevelObjects)
let views = (topLevelObjects as! Array<Any>).filter { $0 is NSView }
@sonsongithub
sonsongithub / CoreMIDI.swift
Last active July 13, 2023 13:40
CoreMIDI sample using deprecated API
import Foundation
import CoreMIDI
import PlaygroundSupport
//
// CoreMIDI sample control for ZOOM MS-50G/60B/70CDR
// Using deprecated APIs
//
@sonsongithub
sonsongithub / CoreMIDI.swift
Last active July 13, 2023 13:39
CoreMIDI sample using new API for MIDI2
import Foundation
import CoreMIDI
//
// CoreMIDI sample control for ZOOM MS-50G/60B/70CDR
//
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
@sonsongithub
sonsongithub / dummy.swift
Created September 11, 2022 23:50
Prevents the window from being displayed for Mac Catalyst.
class DummyViewController: UIViewController {
deinit {
print(#function)
}
required init?(coder: NSCoder) {
print(#function)
super.init(coder: coder)
}
@sonsongithub
sonsongithub / test.swift
Created August 20, 2022 12:17
for #60673
if let obj = CommandLine.arguments.first {
print(obj)
}
tccd Prompting policy for hardened runtime; service: kTCCServiceAppleEvents requires entitlement com.apple.security.automation.apple-events but it is missing for accessing={<TCCDProcess: identifier=com.sonson.HomeConMenu.macOS, pid=632, auid=501, euid=501, binary_path=/Applications/HomeConMenu.app/Contents/MacOS/HomeConMenu>}, requesting={<TCCDProcess: identifier=com.apple.appleeventsd, pid=331, auid=55, euid=55, binary_path=/System/Library/CoreServices/appleeventsd>},