Skip to content

Instantly share code, notes, and snippets.

@lselden
lselden / pkg-winsw-wrapper.mjs
Last active November 6, 2023 21:01
you don't need node-windows! Here's an example of running a vercel/pkg packaged node executable as a windows service by wrapping winsw
// DISCLAIMER! Use at own risk, no guarantees, etc. This sample code is adapted from existing code without code review/testing
import fs from 'fs';
import path_ from 'path';
import { promisify } from 'util';
import { execFile } from 'child_process';
export const isPkg = !!process.pkg;
// make pkg keep the executable
// this is done to force pkg to detect as asset (looks for "path.join", but typescript renames)
@lselden
lselden / out-ssml-winrt.ps1
Last active November 11, 2024 00:56
Powershell script to say text using the WinRT speech synthesis API
<#
.SYNOPSIS
Speak text using SSML
.DESCRIPTION
Speak text using SSML, using built in MS speech synthesis. Will output metadata about result, including any embedded <mark>s
.PARAMETER Text
@lselden
lselden / out-ssml.ps1
Created February 6, 2020 21:53
TTS using powershell
<#
.SYNOPSIS
Speak text using SSML
.DESCRIPTION
Speak text using SSML, using built in MS speech synthesis. Will output metadata about result, including any embedded <mark>s. This uses the .NET System.Speech library, which uses the older SAPI5 synthesis system.
Based on code from https://github.com/marak/say.js/
@lselden
lselden / hls-player.html
Last active December 20, 2019 14:37
hls.js player
<html>
<head>
<title>Hls.js demo - basic usage</title>
</head>
<body>
<script>
typeof window !== "undefined" &&
(function webpackUniversalModuleDefinition(root, factory) {
try {
$remoteHost = Read-Host "Enter IP / Hostname"
$port = 23
write-host "Connecting to $remoteHost on port $port"
$socket = new-object System.Net.Sockets.TcpClient($remoteHost, $port)
if($socket -eq $null) { return; }
$stream = $socket.GetStream()
$writer = new-object System.IO.StreamWriter($stream)