Skip to content

Instantly share code, notes, and snippets.

View mntone's full-sized avatar
🏠

monotone mntone

🏠
View GitHub Profile
// Copyright (C) 2023 mntone
// This source code is licensed under the MIT license.
// [Example]
// import { Localize } from './Localize'
//
// const message = Localize.required({
// fieldName: this.#fieldName,
// })
//
@mntone
mntone / server.js
Created June 9, 2023 02:36
Simply nodejs server.
// MIT: Copyright (C) 2023 mntone. All rights reserved.
const fs = require('fs')
const path = require('path')
const http = require('http')
const port = 80
const dirPublic = './'
const indexFile = 'index.html'
const service = (req, res) => {
@mntone
mntone / mp4box.js
Created June 9, 2023 02:08
This is to generate MPEG-DASH stream with MP4box on node.js. It's simply approach, but we cannot use webm container. I use ffmpeg for MPD generation now.
function runMP4box(files) {
const args = ['-dash', '2000', ...files, '-segment-name', 'seg', '-out', 'dash/test.mpd']
console.log(args)
const mp4box = spawn('mp4box', args)
return mp4box
}
function runMP4boxAsPromise(files) {
return new Promise(resolve => {
const mp4box = runMP4box(files)
IID_IVirtualDesktopAccessibility: 9975B71D-0A84-4909-BDDE-B455BBFA55C6
IID_IVirtualDesktopManager: A5CD92FF-29BE-454C-8D04-D82879FB3F1B
IID_IVirtualDesktopNotificationService: 0CD45E71-D927-4F15-8B0A-8FEF525337BF
IID_IVirtualDesktopManagerInternal: B2F925B9-5A0F-4D2E-9F4D-2B1507593C10
IID_IVirtualDesktopPinnedApps: 4CE81583-1E4C-4632-A621-07A53543148F
IID_IVirtualDesktopSwitcherHost: 1BE71764-E771-4442-B78F-EDA2C7F067F3
IID_IVirtualDesktopSwitcherInvoker: 7A25165A-86F1-4B4A-B1D2-E89650CD9589
IID_IVirtualDesktopNotification: CD403E52-DEED-4C13-B437-B98380F2B1E8
IID_IVirtualDesktopHotkeyHandler: 71DB071A-44AE-4271-B9F6-01CFB6A12DEE
IID_IVirtualDesktopTabletModePolicyService: 56B32065-0BB3-42E2-975D-A559DE1316E8
@mntone
mntone / test.swift
Last active December 27, 2021 00:46
Copyright (C) 2021 mntone. All right reserved. This source code is under MIT license.
@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)
func coloredPrimaryColor(localized: String.LocalizationValue) -> AttributedString {
var attributedString: AttributedString = AttributedString(localized: localized)
guard let firstBoldRange = attributedString.range(of: "**") else { return attributedString }
let orig: AttributedString = attributedString
attributedString.removeSubrange(firstBoldRange)
guard let nextBoldRange = attributedString.range(of: "**") else { return orig }
attributedString.removeSubrange(nextBoldRange)
@mntone
mntone / EmphasizableToken.swift
Last active December 27, 2021 01:26
Copyright (C) 2021 mntone. All right reserved. This source code is under MIT license.
import Foundation
enum EmphasizableToken {
case plain(String)
case toggleEmphasize
}
@mntone
mntone / BorderedProminentButtonModifier.swift
Last active December 12, 2021 03:13
Copyright (C) 2021 mntone. All right reserived. This source code is under MIT license.
import SwiftUI
struct BorderedProminentButtonModifier: ViewModifier {
@Environment(\.deviceMetrics)
private var deviceMetrics: WatchDeviceMetrics
func body(content: Content) -> some View {
if #available(watchOS 8.0, *) {
content.tint(.accentColor)
.buttonStyle(.borderedProminent)
@mntone
mntone / PinCodeFactory.swift
Last active December 1, 2020 12:52
何かの残骸。正しく動作しません。ただ,クラス実装は何かに流用できる可能性があります。🌟under MIT license
import CommonCrypto
import CryptoKit
import Foundation
protocol PinCodeFactory {
mutating func update(by timeStep: Int32)
mutating func update(by timeStep: Int32, at baseTime: Int32)
mutating func update(using counter: Int64)
mutating func getPincode(to digits: Int) -> Int32
@mntone
mntone / uint16x8_t.hpp
Last active December 26, 2019 14:16
ゴリ押しやった記念。もっといい書き方あったので本番コードはそれを採用。でもこれだけ並んでるのも楽しいよね。 // MIT License
typedef __m128i uint16x8_t;
template<> inline uint16x8_t uint16x8_swizzle<0, 1, 2, 3, 4, 5, 6, 7>(uint16x8_t a) { return a; }
static inline uint16x8_t _mm_alignr_epi8_sse2(uint16x8_t a, uint16x8_t b, int align) {
return _mm_or_si128(_mm_slli_si128(a, 16 - 2 * align), _mm_srli_si128(b, 2 * align));
}
#if defined(_SIMD_X86_SSSE3)
template<> inline uint16x8_t uint16x8_swizzle<7, 0, 1, 2, 3, 4, 5, 6>(uint16x8_t a) { return _mm_alignr_epi8(a, a, 2); }
@mntone
mntone / uint16x4_t.h
Created December 25, 2019 12:52
MMXで64-bit処理のためのuint16x4_t作ろうとしたけど命令数足りなさすぎて実用的じゃないので,SSE 128-bit最小単位にするように設計変更。ご自由にどうぞ。 >> under MIT License <<
#ifndef _SIMD_UINT16X4_H
#define _SIMD_UINT16X4_H
#include "simd_base.h"
#ifdef __cplusplus
extern "C" {
#endif
// ---