Skip to content

Instantly share code, notes, and snippets.

class BlobReader {
public static toBytes = (ab: ArrayBuffer) => new Uint8Array(ab);
public static EOF = new Error('EOF');
public static LOCK = new Error('LOCK');
private _remain!: Blob;
private _offset = 0;
private _end = false;
@jamesliu96
jamesliu96 / dc.js
Last active January 2, 2023 17:38
Bilibili Live Danmaku Client for Node.js
function exitWithErr(...args) {
console.error('error:', ...args);
process.exit(-1);
}
let roomId = process.argv[2];
if (!roomId) exitWithErr('please provide roomId');
const DEBUG = false;
const rl = require('readline').createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
});
const data = [];
rl.on('line', (line) => {
data.push(line);
[Unit]
Description=Bittorrent Tracker
[Service]
ExecStart=bittorrent-tracker -qsp 6969
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=bittorrent-tracker
<?xml version="1.0" encoding="UTF-8"?>
<PremiereData Version="3">
<Tree ObjectRef="1"/>
<Tree ObjectID="1" ClassID="177f2841-dd5b-43bd-9d9a-79e231bd47dd" Version="1">
<RootBin ObjectRef="2"/>
<Node Version="1">
</Node>
</Tree>
<BinTreeItem ObjectID="2" ClassID="5e0f46fa-384f-4c09-bc53-0b8e2b7005b5" Version="4">
<TreeItemBase Version="4">
function ytbdl() {
until youtube-dl $@;
}
# usage:
# $ ytbdl [...targets]
extra-keys = [ \
[ \
{ key: ESC, popup: '&' }, \
{ key: '/', popup: '~' }, \
{ key: '-', popup: '|' }, \
{ key: HOME, popup: '[' }, \
{ key: UP, popup: ':' }, \
{ key: END, popup: ']' }, \
{ key: PGUP, popup: '&' } \
], \
play_youtube() {
G=(`youtube-dl -g $1`)
echo ${G[1]}
echo ${G[2]}
ffmpeg -i ${G[1]} -i ${G[2]} -c:v copy -c:a copy -f matroska - | ffplay -
}
/** Brainfuck VM */
class BFVM {
static ParseError = class extends Error {
constructor() {
super('parse error');
}
};
static PtrOutOfRangeError = class extends Error {
constructor() {
package main
import (
"fmt"
"image"
"image/draw"
"image/png"
"math/rand"
"os"
"runtime"