Skip to content

Instantly share code, notes, and snippets.

@gurisko
gurisko / README.md
Last active August 29, 2015 14:27
DFS in C++

Depth-first search

Finding number of strongly connected components in graph.

@gurisko
gurisko / config.py
Created August 21, 2015 08:33
Simple crawler written in Python
# default starting url
seed = "http://opera.com/"
# workers number
workers = 20
# max number of discovered URL, None if no limit
limit = 10000
# user-agent name and logging name
@gurisko
gurisko / functionName.js
Last active May 11, 2024 05:41
[NodeJS] Get the current function name or any other function while using strict mode
'use strict';
const findFirstOccurrence = (string, searchElements, fromIndex = 0) => {
let min = string.length;
for (let i = 0; i < searchElements.length; i += 1) {
const occ = string.indexOf(searchElements[i], fromIndex);
if (occ !== -1 && occ < min) {
min = occ;
}
}
127.0.0.1:8529@nimpee> c = db._collection("eLink"); /* use actual collection name here */
[ArangoCollection 1262901971, "eLink" (type edge, status loaded)]
127.0.0.1:8529@nimpee> db._explain('FOR r IN @@collection FILTER r._from == "vDevice/1740442563" RETURN r', { '@collection': c.name() });
Query String (69 chars, cacheable: true):
FOR r IN @@collection FILTER r._from == "vDevice/1740442563" RETURN r
Execution plan:
Id NodeType Est. Comment
1 SingletonNode 1 * ROOT