Skip to content

Instantly share code, notes, and snippets.

View berezovskyi's full-sized avatar

Andrew Berezovskyi berezovskyi

View GitHub Profile
@berezovskyi
berezovskyi / gist:2c4d2a07fa2f35e5e04c
Created September 4, 2014 12:59
convert a uuid to biginteger
private BigInteger getBigIntegerFromUuid(UUID randomUUID) {
ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
bb.putLong(randomUUID.getMostSignificantBits());
bb.putLong(randomUUID.getLeastSignificantBits());
return new BigInteger(bb.array());
}
public class MyClass {
@Autowired
private ConvertAToB convertAToB;
@Autowired
private ConvertBToC convertBToC;
@Autowired
private ConvertCToD convertCToD;
@berezovskyi
berezovskyi / exceptions.txt
Created May 27, 2017 00:04
Java Exceptions
AWTException
AclNotFoundException
ActivationException
AlreadyBoundException
ApplicationException
ArithmeticException
ArrayIndexOutOfBoundsException
AssertionException
BackingStoreException
BadAttributeValueExpException
### Keybase proof
I hereby claim:
* I am berezovskyi on github.
* I am berezovskyi (https://keybase.io/berezovskyi) on keybase.
* I have a public key ASDGrzZ6CyPWdLKe11sN1fE8-bAkM6YlsY-z40n-_b7IyAo
To claim this, I am signing this object:
import rdflib
from rdflib import URIRef
from rdflib.namespace import RDF
g=rdflib.Graph()
g.load('https://example.com/pror/services/catalog/singleton')
def compact_predicate(p):
table = {
"http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf:",
"http://open-services.net/ns/core#": "oslc_core:",
@berezovskyi
berezovskyi / problem.cpp
Created April 1, 2017 12:09 — forked from depp/problem.cpp
A Faster Solution
// Faster solution for:
// http://www.boyter.org/2017/03/golang-solution-faster-equivalent-java-solution/
// With threading.
// g++ -std=c++11 -Wall -Wextra -O3 -pthread
// On my computer (i5-6600K 3.50 GHz 4 cores), takes about ~160 ms after the CPU
// has warmed up, or ~80 ms if the CPU is cold (due to Turbo Boost).
// How it works: Start by generating a list of losing states -- states where the
// game can end in one turn. Generate a new list of states by running the game
@berezovskyi
berezovskyi / mvn.log
Created October 14, 2016 07:03
ldspider build failure
~/code/ldspider (f-oldpom ✘)✭ ᐅ mvn clean package -U
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.ontologycentral:ldspider:jar:1.3
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. @ line 204, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 217, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
{
"results": [
{
"LAYERNAME": "e57466f1-85ac-4a1a-89eb-f82df609c59a",
"RESTITLE": "3D-byggnadsblock",
"SCOPE": "Tjänst",
"PUBLISHER": "Stockholms stad",
"HASGEOEXTENT": "Nej",
"METAIMPORTDATE": "2016-06-16",
"MDCLASS": "6",
package com.company.my;
import java.io.IOException;
import java.util.Collections;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:ldp="http://www.w3.org/ns/ldp#"
xmlns:trs="http://open-services.net/ns/core/trs#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >
<rdf:Description rdf:about="urn:urn-3:cm1.example.com:2016-06-20T11:09:56Z:403">