Skip to content

Instantly share code, notes, and snippets.

View orian's full-sized avatar

Paweł Szczur orian

View GitHub Profile
@orian
orian / req-failing-with-deadline-exceeded.go
Last active January 27, 2023 15:29
golang send a http request with a context deadline exceeded
package main
import (
"context"
"net/http"
)
func checkErr(err error) {
if err != nil {
panic(err)
@orian
orian / weather-schema.sql
Last active August 1, 2022 13:26
simple schema for weather table
create table weather (longitude double not null,
latitude double not null,
time_ timestamp not null,
u10 double not null,
v10 double not null,
snow_density float not null,
snow_depth float not null,
snowfall float not null,
snowc double not null,
smlt double not null,
@orian
orian / crypt.py
Last active April 12, 2022 20:48 — forked from fideloper/crypt.py
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

Old levenstein:

/tmp/___gobench_github_com_datainq_teryt_search -test.v -test.bench . -test.run ^$
goos: linux
goarch: amd64
pkg: github.com/datainq/teryt/search
BenchmarkSearch_SearchOld
BenchmarkSearch_SearchOld-8   	      31	  40371148 ns/op
BenchmarkSearch_Search
go test -test.v -test.bench ^BenchmarkSearch_Search.*$ -test.run ^$
goos: linux
goarch: amd64
pkg: github.com/datainq/teryt/search
BenchmarkSearch_SearchOld
BenchmarkSearch_SearchOld-8 37 33642952 ns/op
BenchmarkSearch_Search
BenchmarkSearch_Search-8 152 7784588 ns/op
BenchmarkSearch_SearchV3
BenchmarkSearch_SearchV3/parallel-1
@orian
orian / StarterPipelineTest.java
Created May 10, 2018 12:30
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
orian / gen.py
Last active July 11, 2020 18:54
# pip install pyqrcode
# pip install pypng
import pyqrcode
for i in range(1000,1500):
number = pyqrcode.create(i)
number.png('dest/{}.png'.format(destdir,i))
@orian
orian / formatjson.go
Last active September 25, 2018 13:52
A super simple JSON formatter in Go.
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
)
@orian
orian / what-if-shutdown-from-handler.go
Last active May 17, 2018 10:28
An example of server shutdown from handler func.
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"
)