Skip to content

Instantly share code, notes, and snippets.

.DS_Store
tmp/
/**
* The sample usage of ECMA 5 Mozilla Features Implemented in V8
* https://github.com/joyent/node/wiki/ECMA-5-Mozilla-Features-Implemented-in-V8
* You can use thease new feature of ECMA5 on Node.js as you like.
* because there is no IE :)
* Order is deferent form original wiki.
* Sources are Checked on Node.js v0.5.0(unstable), v0.4.9(stable)
*
* you can execute this file.
* $ node ecma5_on_v8.js
@wbzyl
wbzyl / pr.md
Created March 25, 2013 14:04 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

Mathematics: What do grad students in math do all day?

by Yasha Berchenko-Kogan

A lot of math grad school is reading books and papers and trying to understand what's going on. The difficulty is that reading math is not like reading a mystery thriller, and it's not even like reading a history book or a New York Times article.

The main issue is that, by the time you get to the frontiers of math, the words to describe the concepts don't really exist yet. Communicating these ideas is a bit like trying to explain a vacuum cleaner to someone who has never seen one, except you're only allowed to use words that are four letters long or shorter.

What can you say?

@wbzyl
wbzyl / dump_tweet.js
Created March 15, 2013 10:36
Dump data from Elasticsearch
var rest = require('restler');
var iterate = function(data) { // funkcja rekurencyjna
rest.get('http://localhost:9200/_search/scroll?scroll=10m', { data: data._scroll_id } )
.on('success', function(data, response) {
if (data.hits.hits.length != 0) {
data.hits.hits.forEach(function(tweet) {
console.log(JSON.stringify(tweet)); // wypisz JSONa w jednym wierszu
});
iterate(data);
@wbzyl
wbzyl / TODO.md
Last active December 14, 2015 14:18
Skrypty i konfiguracja ES

Sigma

Na sigmie katalogi domowe użytkowników sa udostępniane via NFS. Elasticsearch ma problemy z NFS jeśli liczba shards nie jest równa 1 i liczba replik nie jest równa 0.

Wtyczka Head pokazuje stan health cluster jako żółty lub czerwony (zamiast zielonego).

upstream your-app {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
server unix:/tmp/your_app.socket fail_timeout=0;
}
server {
listen 80;
var fs = require('fs');
var start_fs = (new Date()).getTime();
var data = fs.readFileSync('./100_log', 'utf-8');
var start = (new Date()).getTime();
var log = data.split('\n').map(function (line) {
var match = line.match(/\[([^\]]+)\] \[([^\]]+)\] \[([^ ]+) ([^\]]+)\] (.*)/);
@wbzyl
wbzyl / couchdb.sh
Last active December 10, 2015 18:48
CouchDB
#! /bin/bash
$HOME/.couchdb/bin/couchdb -A $HOME/.data/etc/couchdb/local.d
// make sure we're using the right db; this is the same as "use aggdb;" in shell
db = db.getSiblingDB("aggdb");
// simple projection
var p1 = db.runCommand(
{ aggregate : "article", pipeline : [
{ $project : {
tags : 1,
pageViews : 1
}}