Skip to content

Instantly share code, notes, and snippets.

View mntone's full-sized avatar
🏠

monotone mntone

🏠
View GitHub Profile
// This source is under MIT license.
import UIKit
extension UIAlertAction {
public var isEnabled: Bool {
get { return value(forKey: "enabled") as! Bool }
set { setValue(newValue, forKey: "enabled") }
}
public var isChecked: Bool {
@mntone
mntone / clock.lua
Last active October 25, 2023 01:53
Sets a text source to act as a clock when the source is active. The format matches `strftime`. Use only in OBS Studio 21.0 and later!
obs = obslua
source_name = ""
tick = 1000
last_text = ""
format = ""
activated = false
local s_unit = 1000 * 1000 * 1000 -- [ns]
// 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 / 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 / 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 / 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 / int24_t.hpp
Created June 24, 2015 08:40
int24_t for C++
#pragma once
#pragma pack(push, 1)
using int24_t = struct _int24_t
{
int32_t data : 24;
_int24_t(int8_t integer)
: data(integer)
{ }
_int24_t(uint8_t integer)