Skip to content

Instantly share code, notes, and snippets.

@jacket-code
jacket-code / example.c
Last active August 29, 2015 14:09 — forked from dspezia/example.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "hiredis.h"
#include "async.h"
#include "adapters/libevent.h"
void subCallback(redisAsyncContext *c, void *r, void *priv) {
redisReply *reply = r;
@jacket-code
jacket-code / example.c
Last active August 29, 2015 14:10 — forked from dspezia/example.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include "hiredis.h"
#include "async.h"
#include "adapters/ae.h"
#include "sha1.h"
@jacket-code
jacket-code / entropy.c
Last active August 29, 2015 14:10 — forked from dspezia/entropy.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@jacket-code
jacket-code / win-gettimeofday.c
Created December 16, 2015 08:21 — forked from ugovaretto/win-gettimeofday.c
gettimeofday implementaiton for windows
#include < time.h >
#include < windows.h >
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif