Skip to content

Instantly share code, notes, and snippets.

View lpenguin's full-sized avatar

Nikita Prianichnikov lpenguin

  • Munich
  • 01:38 (UTC +02:00)
View GitHub Profile
CREATE TABLE gsm
( ID REAL,
title TEXT,
gsm TEXT,
series_id TEXT,
gpl TEXT,
status TEXT,
submission_date TEXT,
last_update_date TEXT,
type TEXT,
http_access allow all
http_port 80
forwarded_for off
via off
request_header_access Via deny all
request_header_access Proxy deny all
request_header_access X-Forwarded-For deny all
coredump_dir /var/spool/squid3
request_header_access Allow allow all
@lpenguin
lpenguin / gist:a8d7057ee7004f90787d
Created July 17, 2015 15:22
Search: term search relevance word distance
https://www.google.ru/search?es_sm=91&q=term+search+relevance+word+distance&oq=term+search+relevance+word+distance&gs_l=serp.3...16210.18208.0.18558.14.9.0.0.0.0.127.127.0j1.1.0....0...1c.1.64.serp..14.0.0.hFDzymCGgTQ
https://en.wikipedia.org/wiki/Proximity_search_(text)
http://docs.clusterpoint.com/wiki/Relevance_ranking
https://docs.marklogic.com/guide/search-dev/relevance
https://www.elastic.co/guide/en/elasticsearch/guide/current/scoring-theory.html
http://jaganadhg.freeflux.net/blog/archive/2010/10/16/wordnet-sense-similarity-with-nltk-some-basics.html
http://www.cs.duke.edu/courses/spring14/compsci290/assignments/lab02.html
http://sujitpal.blogspot.ru/2014/12/semantic-similarity-for-short-sentences.html
https://www.elastic.co/guide/en/elasticsearch/guide/current/multi-word-synonyms.html
@lpenguin
lpenguin / read_file.py
Created November 10, 2015 20:50
read file
file_name = '/path/to/file'
pubchem_ids = []
# reading all pubchem ids
with open(file_name) as f:
for line in f:
# removing endline symbols
line = line.rstrip('\n')
@lpenguin
lpenguin / check.py
Last active November 22, 2015 20:27
check.py
def checknotnull(item, notnullfields):
if not all(f in item for f in notnullfields):
raise Exception(item)
return item
from preproc.pipeline import Pipeline
from preproc.pipeline.heplers import extract_supplementary_files, match_samples_in_dir
from ...task import TaskDescription
from os.path import join, basename
from rpy2.robjects import packages as rpackages
import numpy as np
import pandas as pd
import re
from glob import glob
@lpenguin
lpenguin / badsearch.py
Last active December 15, 2015 08:27
bad search
from elasticsearch import Elasticsearch, TransportError
import json
client = Elasticsearch()
try:
client.search(body={'foo': 'bar'})
except TransportError as ex:
print(ex.error)
print(json.dumps(ex.info, indent=2))
"""
@lpenguin
lpenguin / index.html
Last active June 11, 2016 16:59 — forked from monfera/.block
lp zjonsson's d3.js+Leaflet integration (brushed up)
<!DOCTYPE html>
<html>
<head>
<title>Testing d3.js in Leaflet.js</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
<script src="http://mbostock.github.com/d3/d3.v2.js?2.8.1"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<style type="text/css">
svg , g
@lpenguin
lpenguin / reflect.py
Last active September 17, 2016 08:38 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
import sys
def pr(msg):
sys.stderr.write(str(msg))