Skip to content

Instantly share code, notes, and snippets.

View fabianvf's full-sized avatar

Fabian von Feilitzsch fabianvf

View GitHub Profile
@fabianvf
fabianvf / Marvel REST commands
Last active August 29, 2015 14:01
Marvel commands for dummy hierarchy in ElasticSearch
GET _search
{
"query": {
"match_all": {}
}
}
DELETE website
PUT website
### Keybase proof
I hereby claim:
* I am fabianvf on github.
* I am fabianvf (https://keybase.io/fabianvf) on keybase.
* I have a public key whose fingerprint is 0D2E 3DAC 3091 715B 7687 2B45 A87E 7040 BF11 F6F0
To claim this, I am signing this object:
@fabianvf
fabianvf / DEBIAN | UBUNTU
Last active August 29, 2015 14:13
Getting Elasticsearch1.4.2 with wikipedia data loaded
# Install elasticsearch
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.2.deb
sudo dpkg -i elasticsearch-1.4.2.deb
# Install the wikipedia river
/usr/share/elasticsearch/bin/plugin -i elasticsearch/elasticsearch-river-wikipedia/2.4.1
# Start elasticsearch
sudo service elasticsearch start
@fabianvf
fabianvf / Get
Last active August 29, 2015 14:17
How to get data from the OSF elasticsearch endpoint
import requests
response = requests.get('https://osf.io/api/v1/search/', params={
'q': 'test AND category:project' # Full lucene syntax accepted: http://lucene.apache.org/core/2_9_4/queryparsersyntax.html
})
results = response.json()
@fabianvf
fabianvf / example.py
Last active August 29, 2015 14:17
Graph data osf
# coding: utf-8
import json
import requests
HEADERS = {
'Content-type': 'application/json'
}
URL = 'https://osf.io/api/v1/search/'
@fabianvf
fabianvf / Example document.json
Last active August 29, 2015 14:18
json schema
{
"collectionTime": "2014-03-14T00:00:00Z",
"creationDate": "2014-09-12",
"creator": [
{
"name": "Roger Danger Ebert",
"sameAs": [
"/wrgr2/",
"DAE"
],
import os
import json
from scrapi.processing.base import BaseProcessor
class StorageProcessor(BaseProcessor):
NAME = 'storage'
def process_raw(self, raw):
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
@fabianvf
fabianvf / typed_compose.py
Created November 18, 2015 23:41
Typed compose
from typing import Callable, TypeVar
T = TypeVar('T')
T2 = TypeVar('T2')
T3 = TypeVar('T3')
def compose(func1: Callable[[T], T2],
func2: Callable[[T3], T]) -> Callable[[T3], T2]:
def inner(arg: T3) -> T2:
@fabianvf
fabianvf / RFE_template.md
Last active July 21, 2016 18:11
FIrst stab at a template for useful feature requests

Motivation:

  • Why do you want this feature?
  • Is it a priority? Why?
  • Who needs it (internal, customer, etc)?

Current Behavior:

  • If you are proposing a change to an existing feature, where does the existing feature fall short?
  • If it is too difficult to use in its current state, where does the difficulty lie?

Desired Behavior: