Skip to content

Instantly share code, notes, and snippets.

View balajahe's full-sized avatar

Евгений Баладжа balajahe

View GitHub Profile
@balajahe
balajahe / gist:798b8a0dd0eeda57be582e509e4bf1e5
Created April 1, 2021 06:04
firebase_ml_vision BUILD ERROR
Launching lib/main.dart on Nokia 3 2 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform play-services-base-16.0.1.aar (com.google.android.gms:play-services-base:16.0.1) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.status=release}.
> Execution failed for AarResourcesCompilerTransform: /home/user/.gradle/caches/transforms-2/files-2.1/2ea5d7a03e44f60bb834c70b483efa76/jetified-play-services-base-16.0.1.
> AAPT2 aapt2-4.1.0-6503028-linux Daemon #0: Unexpected error during compile '/home/user/.gradle/caches/transforms-2/files-2.1/2ea5d7a03e44f60bb834c70b483efa76/jetified-play-services-base-16.0.1/res/drawable-xhdpi-v4/common_google_signin_btn_text_dark_normal_background.9.png', attempting to stop daemon.
@balajahe
balajahe / main.dart
Created March 28, 2021 13:41 — forked from PlugFox/main.dart
dart web worker
import 'communicator.dart';
void main() {
final communicator = WorkerCommunicator('worker.dart.js')
..listen((event) {
print('Data from worker: "$event"');
});
communicator.add('Ping');
}
@balajahe
balajahe / test_task_test.go
Last active July 29, 2020 09:58
Unit tests for test_task.go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"testing"
)
@balajahe
balajahe / test_task.go
Last active July 29, 2020 09:57
Простой REST на Golang
/*
Один обработчик на все пути:
Реализовано стандартными средствами языка - через возврат функции с замыканием параметра.
Конечно, можно было использовать сторонние библиотеки роутинга, или middleware.
*/
package main
import (
"encoding/json"
"fmt"
//deno 0.32.0
//v8 8.1.108
//typescript 3.7.2
const buf_size = 40960 //4096 - standard value //16384 - max allowed value !!!
const buf = new Uint8Array(buf_size)
buf.fill(0x31)
const fn = './deno_file_write_bug.txt'
const f = Deno.openSync(fn, 'w')
@balajahe
balajahe / arraysort_dart.dart
Last active January 1, 2020 08:01
Императивная реализация быстрой сортировки на Dart, существенно медленнее Scala
import 'dart:math';
void main() {
var rnd = Random();
var arr = List.generate(10000000, (_) => rnd.nextDouble());
sort_imp(arr);
//print(arr);
}
void sort_imp(List<double> arr) {
@balajahe
balajahe / arraysort_rust.rs
Last active December 31, 2019 20:05
Императивная и функциональная реализация быстрой сортировки на Rust
/*
[dependencies]
rand = "0.7"
*/
fn main() {
use rand::Rng;
let mut rng = rand::thread_rng();
let mut arr = (1..10_000_000).map(|_| rng.gen::<f64>()).collect();
let tbegin = std::time::SystemTime::now();
//sort_imp(&mut arr);
@balajahe
balajahe / arraysort_scala.scala
Last active December 31, 2019 19:59
Императивная и функциональная реализация быстрой сортировки на Scala
object Main extends App {
var arr = Array.fill(10000000)(java.lang.Math.random)
val tbegin = new java.util.Date().getTime()
//sort_imp(arr)
arr = sort_fun(arr)
println((new java.util.Date().getTime() - tbegin)/1000.0)
//println(arr.mkString(", "))
def sort_imp(arr: Array[Double]) {
def swap(i: Int, j: Int) {
@balajahe
balajahe / rust_json_parse.rs
Last active July 29, 2020 04:14
Многопоточный парсер JSON на Rust, обсуждение здесь - https://balajahe.github.io/swift_vs_rust/
//[dependencies]
//serde_json = "1.0"
use std::collections::{HashMap, HashSet};
use std::process::exit;
use serde_json::Value;
const FILE_BUF_SIZE: usize = 65535;
const CHANNEL_BUF_SIZE: usize = 10000;
const THREAD_SLEEP: std::time::Duration = std::time::Duration::from_nanos(1000);
@balajahe
balajahe / browser_auto_scroll.js
Last active August 3, 2020 04:37
Скрипт авто-скроллинга бесконечных WEB-страниц
window.onkeydown = (ev) => {
if (ev.keyCode === 32) {
ev.preventDefault()
if (!window.I) {
window.I = setInterval(
() => window.scrollTo(0, window.pageYOffset+100000),
100
)
} else {
clearInterval(window.I)