This file contains 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
'use strict' | |
if (!globalThis.prompt) { | |
const buffer = require('buffer') | |
const fs = require('fs') | |
const input = buffer.Buffer.alloc(10000) | |
globalThis.prompt = (message, defaultValue = '') => { | |
message && console.info(message) | |
let offset = 0 | |
while (fs.readSync(0, input, offset, 1)) { |
This file contains 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 ranks = (values, comparator = (a, b) => b - a) => values | |
.map((value, i) => [value, i]) | |
.slice().sort(([a], [b]) => comparator(a, b)) | |
.reduce((ranks, [value, i], rank, ordered) => [ | |
...ranks.slice(0, i), | |
rank && !comparator(value, ordered[rank - 1][0]) ? ranks[ordered[rank - 1][1]] : rank + 1, | |
...ranks.slice(i + 1), | |
], Array.from({length: values.length})) |
This file contains 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
#ifndef ARDUINO_M5STACK_Core2 | |
#include <M5Stack.h> | |
#else | |
#include <M5Core2.h> | |
#endif | |
#include <utility/M5Timer.h> | |
#include <esp_bt.h> | |
#include <esp_bt_main.h> |
This file contains 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
#include <M5Core2.h> | |
#include <WiFi.h> | |
//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2 | |
void selectWiFi(String &ssid, uint8_t &encType, int32_t &rssi, uint8_t* &bssid, int32_t &channel) { | |
auto& d = M5.Lcd; | |
d.fillScreen(BLACK); |
This file contains 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
<!doctype html> | |
<html class="h-100"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<title>VLW viewer</title> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous"> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/mustache.min.js"></script> |
This file contains 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
'use strict' | |
;(async () => { | |
const handleSelectImage = (input, select) => { | |
input.addEventListener('change', e => { | |
const files = [...input.files] | |
const image = files.filter(f => f.type.startsWith('image/')) | |
if (image.length) { | |
const file = image[0] |
This file contains 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 encodeWindows31J = text => { | |
const range = (from, to) => [...Array(to - from + 1).keys()].map(b => b + from) | |
const islead = b => (b >= 0x81 && b <= 0x9F) || (b >= 0xe0 && b <= 0xef) | |
const follows = [...range(0x40, 0x7e), ...range(0x80, 0xfc)] | |
const decoder = new TextDecoder('Windows-31J') | |
const sbmap = b => ({ [decoder.decode(new Uint8Array([b]))]: [b] }) | |
const dbmap = l => follows.reduce((mapping, f) => ({ ...mapping, [decoder.decode(new Uint8Array([l, f]))]: [l, f] }), {}) |
This file contains 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
<?php | |
declare(strict_types=1); | |
namespace Damn\IO; | |
use ZipArchive; | |
class ExcelWriter | |
{ |
This file contains 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
using Microsoft.VisualBasic; | |
using NlsTest; | |
using System; | |
using System.Globalization; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
const int COMPARE_STRING = 1; | |
const int NORM_IGNOREWIDTH = 0x00020000; |
This file contains 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
document.addEventListener('DOMContentLoaded', _ => { | |
const x0208 = [ 0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B,0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E,0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD,0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0x005C,0x301C,0x2016,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C,0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B,0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E,0x300F,0x3010,0x3011,0xFF0B,0x2212,0x00B1,0x00D7,0x00F7,0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E,0x2234,0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5,0xFF04,0x00A2,0x00A3,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20,0x00A7,0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7,0x25C6,0x25A1,0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x203B,0x3012,0x2192,0x2190,0x2191,0x2193,0x3013,0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A,0x2229,0x2227,0x2228,0x00AC,0x21D2,0x21D4,0x2200,0x2203,0x2220,0x22A5,0x2312,0x2202,0x2207,0x2261,0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x223 |