Skip to content

Instantly share code, notes, and snippets.

View juntalis's full-sized avatar

Charles Grunwald juntalis

View GitHub Profile
@Arbow
Arbow / Thread.php
Created May 20, 2011 03:56
PHP Process Pool With Executor
<?php
//Found on http://www.alternateinterior.com/2007/05/multi-threading-strategies-in-php.html
//Modified by http://www.php-code.net
//Modified: add executor
class Thread {
var $pref ; // process reference
var $pipes; // stdio
var $buffer; // output buffer
var $output;
var $error;
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__ ======
@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"
@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,
@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 {
@madhur
madhur / approval.js
Created January 9, 2012 18:22
SharePoint 2010 Approval workflow with dynamic approvers
<div id='intake'>
<img src="/sites/nishantverma/GBSRequest/SiteAssets/loading.gif" />
<br/>
Submitting your request for approval
</div>
<script type="text/javascript" src="/sites/nishantverma/GBSRequest/SiteAssets/jquery-1.7.1.js"></script>
<script type="text/javascript" src="/sites/nishantverma/GBSRequest/SiteAssets/jquery.SPServices-0.7.0.min.js"></script>
#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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hiredis.h>
int main(int argc, char **argv) {
redisContext *c;
redisReply *reply;
const char *hostname = (argc > 1) ? argv[1] : "127.0.0.1";
@sunxiaoguang
sunxiaoguang / benchmark.c
Created August 14, 2017 07:48
hgetall optimization sample data generator and benchmark code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hiredis.h>
#include <sys/time.h>
long long elapsed(struct timeval *start, struct timeval *end) {
return (end->tv_sec * 1000000l + end->tv_usec) - (start->tv_sec * 1000000l + start->tv_usec);
}
@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',