Skip to content

Instantly share code, notes, and snippets.

@roxlu
roxlu / main.cpp
Created February 22, 2014 15:36
LibHARU + PDF
/*
PDF
----
Very basic application which generates a poster from a
set of images. This application was created because I wanted
to have a poster from my instagram images. It uses a couple of
php files that login to my instagram account and generates a
shell script which downloads them to a directory.
@roxlu
roxlu / README.md
Created February 23, 2014 13:57 — forked from mbostock/.block

Mitchell’s best-candidate algorithm generates a new random sample by creating k candidate samples and picking the best of k. Here the “best” sample is defined as the sample that is farthest away from previous samples. The algorithm approximates Poisson-disc sampling, producing a much more natural appearance (better blue noise spectral characteristics) than uniform random sampling.

See also the white-on-black and Voronoi variations of this example.

#include "krx_dtls.h"
int krx_dtls_init() {
SSL_library_init();
SSL_load_error_strings();
ERR_load_BIO_strings();
OpenSSL_add_all_algorithms();
return 0;
}
@roxlu
roxlu / test_vorbis.c
Last active August 29, 2015 14:00
Decoding vorbis flow (w/o cleanup yet).
/*
test_vorbis
------------
See online version: https://gist.github.com/roxlu/af1ffc1290b9dc37b5b9
Example code which decodes a .ogg file that contains vorbis and/or
some other stream, e.g. theora. We ignore all non-vorbis streams and
simply flush the packets.
@roxlu
roxlu / Reader.cpp
Created July 31, 2014 13:43
Testing the integrity of stun message. See http://tools.ietf.org/html/rfc5389#section-15.4 and http://tools.ietf.org/html/rfc5769#section-2.2 (validates correctly, code is still work in progress).
#include <stun/Reader.h>
#include <openssl/engine.h>
#include <openssl/hmac.h>
#include <openssl/evp.h>
namespace stun {
/* --------------------------------------------------------------------- */
@roxlu
roxlu / Parsing_Stun.txt
Created July 31, 2014 17:49
Some test data that can be used when parsing stun messages (WebRTC/ICE/STUN)
Below is a dump of a STUN message that can be used to validate your
STUN message integrity check. The password that is used to encrypt
the Message-Integrity is: "Q9wQj99nsQzldVI5ZuGXbEWRK5RhRXdC" (without quotes)
/* Raw STUN message as received from Chrome */
-----------
00 01 00 58
21 12 A4 42
48 75 38 77
@roxlu
roxlu / test_fex_load_image.cpp
Created August 22, 2014 13:22
Examples on how to load + reuse memory using rx_load_png and rx_load_jpg
/*
test_fex_load_image
-------------------
Plain test which loads + reloads a couple of images and reallocating the
previously allocated buffer when needed. Just a tiny test to speed up
the image loading process.
*/
dding: 422.593750, 34.640625
Adding: 422.593750, 36.640625
Adding: 422.593750, 41.863281
Adding: 422.593750, 49.175781
Adding: 422.593750, 66.929688
Adding: 422.593750, 75.285156
Adding: 422.593750, 84.687500
Adding: 422.593750, 93.042969
Adding: 422.593750, 100.355469
Adding: 422.593750, 110.101562
MODULE Server
PERS tooldata myTool:=[TRUE,[[0,0,1],[1,0,0,0]],[1,[0,0,0.1],[1,0,0,0],0,0,0]];
TASK PERS wobjdata myWobj:=[FALSE,TRUE,"",[[400,0,400],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
!CONST robtarget myRobtarget:=[[0,0,0],[0.707107,0,0.707107,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
VAR robtarget myRobtarget:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
VAR socketdev server_socket;
VAR socketdev client_socket;
PROC main()
! SocketCreate server_socket;
@roxlu
roxlu / fun.cpp
Last active August 29, 2015 14:19 — forked from kizzx2/fun.cpp
THIS DOES NOT WORK WITH 5.2
// fun.cpp
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
#include <iostream>