Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
@dvliman
dvliman / gist:ae0d1123348c62ffe99b
Last active August 29, 2015 14:17
interleave data stream
say you have data sources with pagination, where you iterate with page and per_page
http://host/articles?topic=action (page = [0,1,2,...] per_page = 10 | 20 | 30)
http://host/articles?topic=puzzle (page = [0,1,2,...] per_page = 10 | 20 | 30)
http://host/articles?topic=shooter (page = [0,1,2,...] per_page = 10 | 20 | 30)
http://host/articles?topic=rpg (page = [0,1,2,...] per_page = 10 | 20 | 30)
Each article is tagged one and one only for the 'topic'. And then, you
realize that some topics (action, puzzle, shooter, rpg) are actually 'games'
so you define game is a set topics [action, puzzle, shooter, and rpg)
UNIVERSITY OF KANSAS MEDICAL CENTER
UNIVERSITY OF KANSAS MEDICAL CENTER
KANSAS STATE UNIVERSITY
THE UNIVERSITY OF KANSAS
SPRINT NEXTEL CORPORATION
SPRINT NEXTEL CORPORATION
SPRINT NEXTEL CORPORATION
GARMIN INTERNATIONAL, INC.
SPRINT NEXTEL CORPORATION
THE UNIVERSITY OF KANSAS MEDICAL CENTER
@dvliman
dvliman / gist:cd43db0419f400725fbd
Created February 19, 2015 00:05
uninstall-node-pkg
if you installed node pkg from official website, here is how to uninstall
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
sudo rm /usr/local/bin/node
sudo rm /usr/local/share/man/man1/node.1
brew install node
drwxr-xr-x 7 dv staff 238B Jul 18 2014 HackerSwifter
drwxr-xr-x 27 dv staff 918B Aug 17 15:46 NewsBlur
drwxr-xr-x 11 dv staff 374B Jun 24 2014 ScalaWebscraper
drwx------@ 6 dv staff 204B May 10 2014 ScrapeBox
drwxr-xr-x 20 dv staff 680B Jul 18 2014 SwiftHN
drwxr-xr-x 18 dv staff 612B Dec 25 14:06 atlas
drwxr-xr-x 24 dv staff 816B Sep 9 10:53 beansdb
drwxr-xr-x 33 dv staff 1.1K Aug 21 21:44 bolt
drwxr-xr-x 11 dv staff 374B Jul 16 2014 buggy
drwxr-xr-x 10 dv staff 340B Sep 8 22:05 cloudtunes
# rob houses (3,5,1,7,9) where the rule is
# you can not rob adjacent houses and the goal
# is to get the maximum sum value
# 3 => 3
# 3, 5 => 5
# 3, 5, 1 => 5
# 3, 5, 1, 7 => 12
# ...
# 3, 5, 1, 7, 9
@dvliman
dvliman / gist:f7ed98edb8b9819277a9
Created January 8, 2015 01:58
coupon-at-checkout
/*
* Coupons at Checkout Browser Extension
* Copyright (c) 2012, 2013 CouponFollow, LLC. All rights reserved.
* Copying this source code in any manner is strictly prohibited.
*/
"use strict";
var storage = chrome.storage.local;

Journey

I was using Boot2Docker 1.2 (OSX) and wanted to use volume for MongoDB. First nothing was happening because 1.2 has no Guest Additions and volumes don't work. There is a workaround by making a boot2docker.iso from master which has Guest Additions.

But then Mongo didn't like putting data on VirtualBox's shared folders:

[initandlisten] 	WARNING: This file system is not supported. For further information see:
[initandlisten] http://dochub.mongodb.org/core/unsupported-filesystems
@dvliman
dvliman / gist:267b66ac3a321172fd35
Created January 4, 2015 03:32
linux-kernel-booting-process

GNU/Linux kernel internals

Linux kernel booting process. Part 1.

If you read my previous blog posts, you can note that sometime ago I have started to get involved low-level programming. I wrote some posts about x86_64 assembly programming for Linux. In the same time I started to dive into GNU/Linux kernel source code. It is very interesting for me to understand how low-level things works, how programs runs on my computer, how they located in memory, how kernel manages processes and memory, how network stack works on low-level and many many other things. I decided to write yet another series of posts about GNU/Linux kernel for x86_64.

Note, that I'm not professional kernel hacker and I don't write code for kernel at work, just a hobby. I just like low-level stuff and it is interesting to me how these

@dvliman
dvliman / main.go
Last active August 29, 2015 14:11 — forked from nmerouze/main.go
package main
import (
"encoding/json"
"log"
"net/http"
"reflect"
"time"
"github.com/gorilla/context"
@dvliman
dvliman / raymond
Last active August 29, 2015 14:09
new
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
class Person {
protected:
string name;
string address;