Skip to content

Instantly share code, notes, and snippets.

View blokhin's full-sized avatar

Evgeny Blokhin blokhin

View GitHub Profile
@blokhin
blokhin / datacite_api_test.py
Last active October 5, 2017 12:56
Datacite API test
import os, sys
import httplib2
import base64
endpoint_meta = 'https://test.datacite.org/mds/metadata?testMode=0'
endpoint_mint = 'https://test.datacite.org/mds/doi?testMode=0'
login = '<login here>'
password = '<pass here>'
Engine Version Codebase size (GZIP in brackets) Rendering method Customization License
JSmol 14.2.15 2.1 MB (700 KB) canvas rich, scripting, in UI LGPL
ChemDoodle Web Components 7.0.1 354 KB (121 KB) WebGL rich, API GPL v3
RasmolJS - 1.1 MB (462 KB) canvas, SDL, asm.js rich, scripting GPL
Player.html 0.13.5 284 KB (84 KB) canvas, Three.js limited, in UI MIT
@blokhin
blokhin / infer.py
Last active November 27, 2015 21:46
Semantic Web Technologies on an Example of Family Trees
import rdflib
from RDFClosure import DeductiveClosure, OWLRL_Extension
g = rdflib.Graph()
g.parse("tsar_family.ttl", format="turtle")
DeductiveClosure(OWLRL_Extension).expand(g)
print g.serialize(format="turtle")
@blokhin
blokhin / miner_bandgaps.md
Created February 7, 2016 13:31
Simple ab initio materials data mining: band gap
Formula (per cell) Band gap, eV Master output
Rh5(1) 0.04 espresso-4.1.1/examples/CLS_FS_example/reference/rh011surf.scf.out
Al5H(1) 0.14 espresso-4.1.1/examples/example12/reference/AlwireH.scf.out
As2(1) 0.25 espresso-5.1.1/PW/tests/vc-relax3.ref
Ni slab(1) 0.29 espresso-4.1.1/examples/dipole_example/reference/ni+co.scf.out
Rh slab(1) 0.3 espresso-4.1.1/examples/CLS_IS_example/reference/rh011slab.scf.out
Ge2(1) 0.44 espresso-5.1.1/PW/tests/paw-vcbfgs.ref
Pt4(1) 0.53 espresso-4.1.1/examples/example22/reference/pt4.out
SnO2(2) 0.61 rutile-OER-master/supporting-data/SnO2/ground/ground.o255939
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_relation_size(C.oid)) AS "size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY pg_relation_size(C.oid) DESC
LIMIT 20;
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) DESC
LIMIT 20;
WITH constants AS (
SELECT current_setting('block_size')::numeric AS bs, 23 AS hdr, 4 AS ma
), bloat_info AS (
SELECT
ma,bs,schemaname,tablename,
(datawidth+(hdr+ma-(case when hdr%ma=0 THEN ma ELSE hdr%ma END)))::numeric AS datahdr,
(maxfracsum*(nullhdr+ma-(case when nullhdr%ma=0 THEN ma ELSE nullhdr%ma END))) AS nullhdr2
FROM (
SELECT
schemaname, tablename, hdr, ma, bs,
SELECT
t.tablename,
indexname,
c.reltuples AS num_rows,
pg_size_pretty(pg_relation_size(quote_ident(t.tablename)::text)) AS table_size,
pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) AS index_size,
CASE WHEN x.is_unique = 1 THEN 'Y'
ELSE 'N'
END AS UNIQUE,
idx_scan AS number_of_scans,
import sys
import ujson as json
from jsonschema import validate, Draft3Validator
try: f, t = sys.argv[1], sys.argv[2]
except IndexError: sys.exit("Usage: schema input_JSON")
schema = json.loads(open(f).read())
Draft3Validator.check_schema(schema)
#!/usr/bin/env python
from urllib import urlencode
import httplib2
import json
api_key = "" # your key
endpoint = "https://api.mpds.io/v0/download/facet"
search = {