Skip to content

Instantly share code, notes, and snippets.

View fuCtor's full-sized avatar

Alexey Shcherbakov fuCtor

View GitHub Profile
select version()
SELECT version()
┌─version()─┐
│ 19.15.3.6 │
└───────────┘
1 rows in set. Elapsed: 0.008 sec.
<yandex>
<interserver_http_port>9009</interserver_http_port>
<remote_servers>
<test_dmp_rt>
<shard>
<replica>
<host>clickhouse-server_1</host>
<port>9009</port>
</replica>
<replica>
file_names = os.listdir(PATH)
texts = []
for name in file_names:
if name.endswith(".txt"):
with codecs.open(PATH + "/" + name, encoding = 'utf-8') as f:
print(name)
text = f.read()
lst = re.findall(r'\w+', text)
words = []
for word in lst:
import java.io._
import monix.reactive.Observable
object FileReader {
def fileObservable(files: Seq[String]): Observable[String] = {
Observable.fromIterable(files).flatMap({ file =>
Observable.fromLinesReader(new BufferedReader(new InputStreamReader(new FileInputStream(file))))
.doOnSubscribe(() => println(s"START [$file]"))
.doOnComplete(() => println(s"FINISH [$file]"))
})
dockerCommands := Source.fromFile(file).mkString
.replace("\\\n", "").split("\n")
.withFilter(_.nonEmpty).map((line) => {
val cmd :: args = line.stripLineEnd.split(" ").toList
Cmd(cmd, args.mkString(" "))
}).toSeq
@fuCtor
fuCtor / macros.scala
Created June 22, 2017 06:05
Scala, проба работы с implicit + tagged type + annotation
import scala.annotation.StaticAnnotation
import scala.language.experimental.macros
import scala.reflect.macros.whitebox.Context
final class currency extends StaticAnnotation {
def macroTransform(annottees: Any*): Any = macro currencyMacro.impl
}
object currencyMacro {
def impl(c: Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {

Keybase proof

I hereby claim:

  • I am fuCtor on github.
  • I am schalexey (https://keybase.io/schalexey) on keybase.
  • I have a public key whose fingerprint is D908 9941 A58D 8929 8822 D376 C18B 068B 0244 D621

To claim this, I am signing this object:

#include "TileInfo.h"
#include <cstdlib>
#include <math.h>
#include <QDebug>
#define PACK_LEVEL 3
#define MAX_LEVEL 18
#define EDGE_LEVEL 12
#define SIZE pow(4.0, MAX_LEVEL)
@fuCtor
fuCtor / chunk.ex
Last active May 25, 2016 14:51
JSON multi object stream parsing with Elixir
defmodule Chunk do
def parse(text) do
case :jsx.decoder(Chunk, [], [:return_tail]).(text) do
{:with_tail, item, ""} -> {item, nil}
{:with_tail, item, tail} -> {item, fn() -> parse(tail) end }
other -> other
end
end
def init(_) do
@fuCtor
fuCtor / azure.json
Last active February 12, 2016 09:34
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"metadata": {
"description": "Location to create the VM in"
}
},