Skip to content

Instantly share code, notes, and snippets.

View jibeetz's full-sized avatar

Jean-Baptiste jibeetz

  • Zug, Switzerland
View GitHub Profile
npm install node-telegram-bot-api openai
node index.js
--------------------
index.js
const TelegramBot = require('node-telegram-bot-api')
const { Configuration, OpenAIApi } = require('openai')
const OPENAI_TOKEN = <OPENAI-TOKEN>
@jibeetz
jibeetz / sprite-viewer.js
Last active March 19, 2024 12:30
SVG Sprite Viewer
// npm install xml2json
// npm install node-fetch (not needed with node v17)
// The svg sprite is set at '/assets/icons/sprite.svg' location
// node sprite-viewer.js
// The script will generate an html file 'sprite.html'
var fs = require('fs');
var parser = require('xml2json');
var util = require('util');
const readFile = util.promisify(fs.readFile);
const writeFile = util.promisify(fs.writeFile);