Skip to content

Instantly share code, notes, and snippets.

View CoolnsX's full-sized avatar
🙂

Tanveer Ahmed Ansari CoolnsX

🙂
View GitHub Profile
@CoolnsX
CoolnsX / presence.sh
Created October 28, 2023 09:04
Implementation of DIscord Rich presence in posix shell script, not depenedent upon python or any other programming language
#!/bin/sh
### Posix compliant script for Discord Rich presence (no need to have python and pypresence) ###
#encode opcode and payload length in little-endian format and prepend it with payload
encode_data() {
op=$1
datalen=${#2}
for i in $(seq 0 3); do
byte=$(((op >> (i * 8)) & 255))