Skip to content

Instantly share code, notes, and snippets.


Paweł Szczur orian

View GitHub Profile
View another benchmark
go test -test.v -test.bench ^BenchmarkSearch_Search.*$ ^$
goos: linux
goarch: amd64
BenchmarkSearch_SearchOld-8 37 33642952 ns/op
BenchmarkSearch_Search-8 152 7784588 ns/op

Old levenstein:

/tmp/___gobench_github_com_datainq_teryt_search -test.v -test.bench . ^$
goos: linux
goarch: amd64
BenchmarkSearch_SearchOld-8   	      31	  40371148 ns/op
orian / formatjson.go
Last active Sep 25, 2018
A super simple JSON formatter in Go.
View formatjson.go
package main
import (
orian /
Created May 10, 2018
Experimenting with TestStream in Apache Beam test framework
package eu.datainq.playground;
import org.apache.beam.sdk.coders.VarIntCoder;
import org.apache.beam.sdk.testing.NeedsRunner;
import org.apache.beam.sdk.testing.PAssert;
import org.apache.beam.sdk.testing.TestPipeline;
import org.apache.beam.sdk.testing.TestStream;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.transforms.Sum;
import org.apache.beam.sdk.transforms.WithKeys;
orian / what-if-shutdown-from-handler.go
Last active May 17, 2018
An example of server shutdown from handler func.
View what-if-shutdown-from-handler.go
package main
import (
orian / closure.d.ts
Created Nov 2, 2017
A Google Closure Library DefinitelyTyped typings
View closure.d.ts
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_eventsource.js
//!! Processing provides [goog.labs.userAgent.engine] from input closure-library/closure/goog/labs/useragent/engine.js
//!! Processing provides [goog.html.TrustedResourceUrl] from input closure-library/closure/goog/html/trustedresourceurl.js
//!! Processing provides [] from input closure-library/closure/goog/events/eventid.js
//!! Processing provides [goog.html.SafeUrl] from input closure-library/closure/goog/html/safeurl.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/intl.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_pointerlock.js
//!! Processing provides [goog.dom.vendor] from input closure-library/closure/goog/dom/vendor.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/w3c_vibration.js
//!! Processing provides [] from input tools/closure-compiler/externs/browser/webkit_notifications.js
View example.go
func (p *XImpl) Listen(_ *empty.Empty, rec services.X_ListenServer) error {
c := make(chan *services.X, 16)
defer p.remove(c)
ctx := rec.Context()
for {
select {
case v := <-c:
if err := rec.Send(v); err != nil {
return err
orian /
Last active Nov 8, 2020 — forked from fideloper/
Decrypt Laravel-encrypted value
# Python3 code below
import os
import base64
import json
from Crypto.Cipher import AES
from phpserialize import loads
import hashlib
import hmac
orian /
Last active Jul 5, 2016
A simple wrapper to apply one function to map keys and another for values.
package eu.pawelsz.apache.beam;
import org.apache.beam.sdk.coders.CannotProvideCoderException;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.coders.CoderRegistry;
import org.apache.beam.sdk.coders.KvCoder;
import org.apache.beam.sdk.transforms.*;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
orian /
Created May 31, 2016
Apache Beam - map only keys / values of PCollection<K<?,?>>
package pl.pawelsz.apache.beam;
import org.apache.beam.sdk.transforms.SimpleFunction;
import org.apache.beam.sdk.values.KV;
public class Only {
public static class Values<TK, TI, TO> extends SimpleFunction<KV<TK, TI>, KV<TK, TO>> {
private final SimpleFunction<TI, TO> map;