Skip to content

Instantly share code, notes, and snippets.

View zinahe's full-sized avatar

Zinahe zinahe

  • Edgewater, New Jersey
View GitHub Profile
@zinahe
zinahe / hexdump.cpp
Created April 2, 2022 18:45 — forked from shreyasbharath/hexdump.cpp
Hexdump - C++ version of XXD style hexdump (based on this StackOverflow answer https://stackoverflow.com/a/7776146/801008)
#include <iomanip>
#include <iostream>
#include <vector>
#include <termcolor.hpp>
void HexDump(const std::vector<uint8_t>& bytes, std::ostream& stream)
{
char buff[17];
size_t i = 0;
@zinahe
zinahe / main.c
Created August 28, 2017 15:54 — forked from zgyarmati/main.c
/* file main.c
* author: Zoltan Gyarmati <mr.zoltan.gyarmati@gmail.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <signal.h>
@zinahe
zinahe / compiling
Created August 28, 2017 15:52 — forked from ralight/compiling
Test libmosquitto SSL against howsmyssl.com
cd mosquitto/lib
cp somewhere/hows.c .
gcc hows.c net_mosq.c logging_mosq.c memory_mosq.c messages_mosq.c mosquitto.c read_handle.c read_handle_client.c read_handle_shared.c send_mosq.c send_client_mosq.c time_mosq.c tls_mosq.c util_mosq.c will_mosq.c -I. -I.. -DWITH_TLS -lrt -lssl -lcrypto -o hows
./hows
#include <stdio.h>
#include <mosquitto.h>
void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message)
{
if(message->payloadlen){
printf("%s %s\n", message->topic, message->payload);
}else{
printf("%s (null)\n", message->topic);
}