Skip to content

Instantly share code, notes, and snippets.

View matheusfillipe's full-sized avatar

Matheus Fillipe matheusfillipe

  • https://gitlab.com/matheusfillipeag
  • Germany
View GitHub Profile
@matheusfillipe
matheusfillipe / paste_this_in_js_console.js
Created April 19, 2022 23:59 — forked from Zibri/paste_this_in_js_console.js
Minimal javascript IRC client in console
function irc(nickname, server, chan, onmsg, onjoin) {
nickname = nickname || "nick_" + new Date().getTime().toString(36) + new Date().getMilliseconds().toString(36)
chan = chan || "Z" + new Date().getTime().toString(18) + Math.random().toString(36).substring(2)
server = server || "irc.unrealircd.org"
var init = 0
var ws = new WebSocket("wss://" + server);
var s = (c,l)=>setTimeout(console.log.bind(this, "%c%s", "font-size: 14px; color:" + c, new Date().toLocaleString("it") + ": " + l))
ws.onmessage = m=>{
if (m.data.indexOf("PING") == 0)
ws.send(m.data.replace("PI", "PO"));