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
/* eslint-disable max-lines-per-function */ | |
// noinspection CssInvalidPropertyValue,JSSuspiciousNameCombination | |
"use client"; | |
import React, { type ReactElement, useEffect, useState } from "react"; | |
import { renderToStaticMarkup } from "react-dom/server"; | |
// Configuration constants | |
const MAGNIFIER_SIZE = 250; |
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
/** | |
* Confluence Documentation Sync Script | |
* | |
* This script automatically syncs a repository's README.md to a Confluence page. | |
* To use this script in another repository: | |
* | |
* 1. Copy this file to your repository's scripts directory | |
* 2. Add the following to your package.json: | |
* ``` | |
* { |
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
#!/bin/bash | |
# Trap and exit on termination | |
trap 'echo "Script terminated. Exiting..."; exit 1' SIGINT SIGTERM | |
# Function to kill ffmpeg and ffprobe processes | |
kill_ff_processes() { | |
pkill -f ffmpeg | |
pkill -f ffprobe | |
} |
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 kotlin.properties.ReadWriteProperty | |
import kotlin.reflect.KMutableProperty0 | |
import kotlin.reflect.KProperty | |
inline class PropertyAlias<T>(val delegate: KMutableProperty0<T>) : ReadWriteProperty<Any?, T> { | |
override operator fun getValue(thisRef: Any?, property: KProperty<*>): T = delegate.get() | |
override operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = delegate.set(value) | |
} |
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
#!/bin/bash | |
# link airport into path if not found | |
which airport || sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport | |
while true ; do | |
CURRENT_SSID=`airport -I | grep "\\s\\+SSID:\\s" | awk '{print $2}'` | |
echo "Currently connected to $CURRENT_SSID" | |
# set wifi interface mac address, computed random blob using openssl and then sed formats into shape, add colon per 2 char, trim trailing colon |
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 java.lang.reflect.InvocationHandler | |
import java.lang.reflect.Method | |
import java.lang.reflect.Proxy | |
import kotlin.properties.Delegates | |
inline fun <reified T : Any> lazyProxyLazy(noinline delegate: () -> T): Lazy<T> { | |
return lazy { proxyLazy(delegate) } | |
} | |
inline fun <reified T : Any> proxyLazy(noinline delegate: () -> T): T { |
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
const { exec } = require("child_process"); | |
async function command(command) { | |
const promise = new Promise((resolve, reject) => { | |
exec(command, (error, stdout, stderr) => { | |
if (error) reject(error) | |
if (stderr) reject(stderr) | |
if (stdout) resolve(stdout) | |
}); | |
}); |
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
fun main(args: Array<String>) { | |
launch { | |
loadAllFiles() | |
} | |
} | |
fun launch(block: suspend () -> Unit) { | |
block.startCoroutine(object : Continuation<Unit> { | |
override val context: CoroutineContext get() = EmptyCoroutineContext | |
override fun resume(value: Unit) {} |
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
val cookieManager = CookieManager.getInstance() | |
cookieManager.removeAllCookies { | |
// undesired async completion handler | |
} | |
suspend fun CookieManager.clearCookies(): Boolean = suspendCoroutine { | |
removeAllCookies(it::resume) | |
} |
NewerOlder