Skip to content

Instantly share code, notes, and snippets.

@vmolsa
vmolsa / hexdump.zig
Last active January 19, 2023 00:18
Hexdump written in zig
// Exmaple: try hexdump(std.io.getStdOut().writer(), "Hello World", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
//
// Hello World
//
// 0000: 4C 6F 72 65 6D 20 69 70 73 75 6D 20 64 6F 6C 6F Lorem ipsum dolo
// 0016: 72 20 73 69 74 20 61 6D 65 74 2C 20 63 6F 6E 73 r sit amet, cons
// 0032: 65 63 74 65 74 75 72 20 61 64 69 70 69 73 63 69 ectetur adipisci
// 0048: 6E 67 20 65 6C 69 74 2C 20 73 65 64 20 64 6F 20 ng elit, sed do
// 0064: 65 69 75 73 6D 6F 64 20 74 65 6D 70 6F 72 20 69 eiusmod tempor i
// 0080: 6E 63 69 64 69 64 75 6E 74 20
@vmolsa
vmolsa / functor.h
Created November 15, 2016 04:27
C++ Functor
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 vmolsa <ville.molsa@gmail.com> (http://github.com/vmolsa)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@vmolsa
vmolsa / rtc-ping-pong.js
Created March 23, 2015 20:58
node-webrtc test for sending buffers
var rtc = require('rtc-stream');
function runTest(instances, channels, times, size, callback) {
var result = {
instances: 0,
channels: 0,
bytesReceived: 0,
bytesSended: 0,
};
@vmolsa
vmolsa / Makefile
Last active August 29, 2015 14:08
Queue / Array in C++
all:
g++ -o QueueArrayTest test.cc -lpthread --debug