Skip to content

Instantly share code, notes, and snippets.

View dselivanov's full-sized avatar

Dmitry Selivanov dselivanov

View GitHub Profile
@sebclaeys
sebclaeys / example.output
Created September 21, 2011 21:03
Read and merge multiple sorted file in C++
shell $ g++ mergetest.cpp
shell $ cat f1.txt
a:1
c:2
f:3
h:4
j:5
l:6
shell $ cat f2.txt
a:1
@entaroadun
entaroadun / gist:1653794
Created January 21, 2012 20:10
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@methane
methane / gist:2185380
Created March 24, 2012 17:28
Tornado Example: Delegating an blocking task to a worker thread pool from an asynchronous request handler
from time import sleep
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
def run_background(func, callback, args=(), kwds={}):
def _callback(result):
@jehiah
jehiah / BufferedMessageHandler.py
Created July 15, 2013 02:05
Buffered NSQ reader (python)
import tornado.ioloop
import logging
import time
class BufferedMessageHandler(object):
"""
Usage:
buffered_handler = BufferedMessageHandler(my_handler)
r = Reader(message_handler=buffered_handler)
@romainfrancois
romainfrancois / gist:6119995
Created July 31, 2013 07:20
Two workarounds to get access to the c level connections api from c++.
#include <Rcpp.h>
// thanks to Simon for the macro magic
// problem #1: R internals uses "private" and "class" as
// member names. So a C++ compiler is confused
// when we include Connections.h
// this workaround uses the preprocessor to rename
// class as class_name and private as private_ptr
#define class class_name
#define private private_ptr
@esfand
esfand / jsonparse.md
Created August 28, 2013 03:58
Rsyslog JSON

Log Message Normalization Module

Module Name: mmjsonparse

Description:

This module provides support for parsing structured log messages that follow the CEE/lumberjack spec. The so-called "CEE cookie" is checked and, if present, the JSON-encoded structured message content is parsed. The properties are than available as original message properties.

Sample:

These code snippets have been tested on R 3.1.0 and Mac OS 10.9.3. They presumably do *not* work on R 2.X!
## Enter these commands in the Mac OS Terminal
# use faster vecLib library
cd /Library/Frameworks/R.framework/Resources/lib
ln -sf /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib libRblas.dylib
# return to default settings
cd /Library/Frameworks/R.framework/Resources/lib
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@zachmayer
zachmayer / openblas.sh
Last active March 14, 2022 03:20
Mac BLAS
#Option 1 - install openblas with homebrew and link to CRAN installed R
brew tap homebrew/science
brew install openblas
ln -sf /usr/local/Cellar/openblas/0.2.12/lib/libopenblas.dylib /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib
#Option 2 - install r with openblas through homebrew
brew tap homebrew/science
brew install r --with-openblas
@dselivanov
dselivanov / memusg
Created November 16, 2015 14:38 — forked from netj/memusg
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <[email protected]>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #