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
import { Session } from 'inspector/promises'; | |
import fs from 'fs'; | |
import net from 'net'; | |
let session; | |
const now = new Date(); | |
const profileFile = `/src/${now.getTime()}.cpuprofile`; | |
function createTCPServer({ | |
onStart, |
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
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: app | |
namespace: default | |
spec: | |
selector: | |
app: app | |
ports: | |
- protocol: TCP |
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
for i in *.ARW; do sips -s format jpeg $i --out "${i%.*}.jpg"; done |
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
INPUT=demo.gif | |
OUTPUT=demo-1.gif | |
ffmpeg -hide_banner -v warning -i $INPUT -filter_complex "[0:v] scale=320:-1:flags=lanczos,split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse" $OUTPUT |
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
// Sample for reading a file asynchronously using libuv | |
// taken from https://www.snip2code.com/Snippet/247423/Sample-for-reading-a-file-asynchronously | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <uv.h> | |
static uv_fs_t openReq; | |
static uv_fs_t readReq; |
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
// I know it's not complete. It was a TDD test I made a few years ago | |
//index.js | |
const single = { | |
1: 'one', | |
2: 'two', | |
3: 'three', | |
4: 'four', | |
5: 'five', | |
6: 'six', |
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
// @erickwendel_ | |
import { Readable } from 'node:stream' | |
import { pipeline } from 'node:stream/promises' | |
const take = (limit) => async function* (source) { | |
let count = 0; | |
for await (const item of source) { | |
if (count++ >= limit) break | |
yield item | |
} |
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
// not iterable | |
{ | |
const myItem = { | |
a: 1, | |
b: 2 | |
} | |
// const r = [...myItem] // TypeError: myItem is not iterable | |
} | |
// now object is iterable |
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 fs = require('fs'); | |
const { | |
spawn | |
} = require('child_process') | |
const soxStream = require('sox-stream') | |
const songPath = './audio/songs/Modern Attempt - TrackTribe.mp3' | |
const fxPath = './audio/fx/Boo! Sound Effect (128 kbps).mp3' | |
const output = 'output.mp3' |
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 heroes = `NickName: Chapolin, Power: Hammer | |
Nick: Batman, Power: Money | |
` | |
const exp = /(NickName|Nick):\s(?<nickname>\w+),\sPower:\s(?<power>\w.*)/gm | |
const matchAll = [...heroes.matchAll(exp)].map(({ | |
groups: { | |
nickname, | |
power | |
} |
NewerOlder