Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
- generateKey | importKey |
const clipboardWrite = (()=>{ | |
const callHandlers = []; | |
window.addEventListener('copy', (e)=>{ | |
if (callHandlers.length <= 0) return; | |
const handler = callHandlers.shift(); | |
return handler(e); | |
}); | |
#!/usr/bin/env python3 | |
# https://gist.github.com/EONRaider/3b7a8ca433538dc52b09099c0ea92745 | |
__author__ = 'EONRaider, keybase.io/eonraider' | |
import fcntl | |
import socket | |
import struct | |
try: | |
from netifaces import AF_INET, ifaddresses |
""" | |
The MIT License (MIT) | |
Copyright © 2020 Walkline Wang (https://walkline.wang) | |
Gitee: https://gitee.com/walkline/esp32-ble-uart | |
Original repo: https://github.com/micropython/micropython/blob/master/examples/bluetooth/ble_uart_peripheral.py | |
""" | |
import ubluetooth as bt | |
__UART_UUID = bt.UUID("6E400001-B5A3-F393-E0A9-E50E24DCCA9E") | |
__RX_UUID = bt.UUID("6E400002-B5A3-F393-E0A9-E50E24DCCA9E") |
import struct | |
import ubluetooth as bt | |
from micropython import const | |
MANUFACTURER_ID = const(0x004C) | |
DEVICE_TYPE = const(0x02) | |
DATA_LENGTH = const(0x15) | |
BR_EDR_NOT_SUPPORTED = const(0x04) | |
FLAG_BROADCAST = const(0x01) | |
MANUFACTURER_DATA = const(0xFF) |
// LogTool | |
{ | |
const SESSION_ID = require('node:crypto').randomBytes(10); | |
let SEQ = 0; | |
const LogStreamMeta = new WeakMap(); | |
class LogStream { | |
constructor() { | |
LogStreamMeta.set(this, { |
function ToLocalISOString(ref_date=undefined, show_milli=false) { | |
if ( this instanceof Date ) ref_date = this; | |
if ( typeof ref_date === "string" || typeof ref_date === "number" ) { | |
ref_date = new Date(ref_date); | |
} | |
else | |
if ( !(ref_date instanceof Date) ) { | |
ref_date = new Date(); | |
} |
import $ from "shstore"; | |
import util from "util"; | |
const STORE_KEY = 'console'; | |
declare global { | |
interface ExtendedSharedStorage{(scope:typeof STORE_KEY):{ | |
colorize:boolean; | |
max_depth:number|null; | |
show_milli:boolean; |
#!/usr/bin/env node | |
const fs = require('fs'); | |
const os = require('os'); | |
if ( os.platform().substring(0,3) === 'win' ) { | |
console.error("This script doens't support windows environment!"); | |
process.exit(1); | |
} |
Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
declare type bytes = Uint8Array; | |
declare type uniqid = string; | |
declare type hex = `0x${string}`; | |
declare type base64 = string; | |
declare type base32 = string; | |
declare type base58 = string; | |
declare type http_str = `${'http'|'https'}://${string}`; | |
declare type email_str = `${string}@${string}.${string}`; |