Skip to content

Instantly share code, notes, and snippets.

View Papouchcom's full-sized avatar

papouch.com Papouchcom

  • Papouch s.r.o.
  • Strašnická 3164, Prague, Czech Republic
View GitHub Profile
@Papouchcom
Papouchcom / binary.js
Created June 26, 2020 07:37 — forked from mathewmariani/binary.js
A quick look at signed and unsigned integers in JavaScript.
var UInt4 = function (value) {
return (value & 0xF);
};
var Int4 = function (value) {
var ref = UInt4(value);
return (ref > 0x7) ? ref - 0x10 : ref;
};
var UInt8 = function (value) {
@Papouchcom
Papouchcom / mod_post_multicast_msg.lua
Last active December 15, 2020 13:09
Clone of Prosody mod_post_msg allowing sending multicast messages/chat via JSON + PHP script example.
module:depends"http"
local jid_split = require "util.jid".split;
local jid_prep = require "util.jid".prep;
local msg = require "util.stanza".message;
local test_password = require "core.usermanager".test_password;
local b64_decode = require "util.encodings".base64.decode;
local json = require "util.json";
local function require_valid_user(f)