Skip to content

Instantly share code, notes, and snippets.

View juntalis's full-sized avatar

Charles Grunwald juntalis

View GitHub Profile
@alexsilva
alexsilva / shserver.cpp
Last active December 23, 2016 00:25
Server model that uses shared memory as a communication channel.
#include <iostream>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include "shared_data.h"
#include "server.h"
using namespace std;
using namespace boost::interprocess;
class SharedMemory {
@alexsilva
alexsilva / shclient.hpp
Last active December 23, 2016 00:25
Client model that uses shared memory as a communication channel.
//
// Created by alex on 21/10/2015.
//
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <iostream>
#include <cstring>
#include "shared_data.h"
#include "client.h"
foo@bar:~/src/quadtree$ redis-cli zcard x
(integer) 100000
foo@bar:~/src/quadtree$ redis-cli zcard y
(integer) 100000
foo@bar:~/src/quadtree$ redis-cli hlen qt
(integer) 56325
foo@bar:~/src/quadtree$ redis-cli script load "`cat rqtih.lua`"
"84f91fddf261e9a2ef14ff4b417443eed3dc4b2b"
foo@bar:~/src/quadtree$ redis-benchmark -n 100 -r 1000000 evalsha 84f91fddf261e9a2ef14ff4b417443eed3dc4b2b 3 x y tmp zquery __rand_int__ __rand_int__ __rand_int__ __rand_int__
====== evalsha 84f91fddf261e9a2ef14ff4b417443eed3dc4b2b 3 x y tmp zquery __rand_int__ __rand_int__ __rand_int__ __rand_int__ ======
@maoueh
maoueh / msys2_cross_compiler_for_rpi.md
Last active January 16, 2022 17:49
Build steps to create a (cross-)compiler creating native code executable targeting raspberry pi (RPi), running on MSYS2 and using MSYS2 to compile the cross-compiler

Build Steps

This document details extra that were needed to build the rpi cross-compiler on MSYS2. The original instructions are located on gurucodings.

This cross-compiler has been created targeting the Raspbian Wheezy OS which is based on Debian Wheezy with special support for the Raspberry PI architecture. The version that was installed on my rpi is 2014-06-20-wheezy-raspbian.

Here the version of the various tools currently present in this version of Raspbian (Guest OS):

  • gcc (Debian 4.6.3-14+rpi1) 4.6.3
  • GNU ld (GNU Binutils for Debian) 2.22
@brettp
brettp / thread-index.py
Last active November 26, 2021 10:39
Python implementation for Outlook's thread-index headers for message threading
import struct
import time
import sys
import base64
import hashlib
import datetime
def parse_thread_index(index: 'str') -> ("tuple (str, array [datetime.datetime, ...])"):
import binascii
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <stropts.h>
#include <unistd.h>
#include <string.h>
#include <sys/signalfd.h>
#define __USE_GNU
@hhrhhr
hhrhhr / aida64_shared_memory.lua
Created March 18, 2015 20:43
test access to shared memory of AIDA64 with luajit
local lpName = "AIDA64_SensorValues"
local FILE_MAP_ACCESS = 0x0004 --> FILE_MAP_READ
local ffi = require("ffi")
ffi.cdef[[
void* __stdcall OpenFileMappingA(
unsigned long dwDesiredAccess,
int bInheritHandle,
@lpereira
lpereira / adblock.py
Last active November 29, 2017 00:08
Block ads and other annoyances by redirecting their host names to 127.0.0.1
#!/usr/bin/python
import requests
sources = [
'http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext',
'http://hosts-file.net/.%5Cad_servers.txt',
'https://adaway.org/hosts.txt',
'http://winhelp2002.mvps.org/hosts.txt',
'http://sysctl.org/cameleon/hosts',
@NikunjGithub
NikunjGithub / Lua hiredis
Last active January 25, 2019 03:00
Invoking Lua script using Eval with hiredis
/*----------------------
EVAL
------------------------*/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <hiredis/hiredis.h>
@clemensg
clemensg / curl_libuv_example.c
Last active November 2, 2023 01:48
An example on how to use libuv with libcurl's multi interface Should be equally fast on Unixes (uses epoll/kqueue/etc like libev/libevent) but MUCH faster on Windows due to libuv's usage of IO completion ports. Could come in handy if you have to manage several hundreds or thousands of connections!
#include <stdio.h>
#include <stdlib.h>
#include <uv.h>
#include <curl/curl.h>
uv_loop_t *loop;
CURLM *curl_handle;
uv_timer_t timeout;
typedef struct curl_context_s {