Skip to content

Instantly share code, notes, and snippets.

View bholota's full-sized avatar

Bartłomiej Hołota bholota

View GitHub Profile
# -*- encoding: utf-8 -*-
import argparse
import fnmatch
import os
import pathlib
import cv2
def files_recursively(dir_path, pattern="*.png"):
import numpy as np
import tensorflow as tf
# manually put back imported modules - bug?
import tempfile
import subprocess
tf.contrib.lite.tempfile = tempfile
tf.contrib.lite.subprocess = subprocess
with tf.name_scope("inputs"):
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import io.reactivex.functions.Consumer;
import io.reactivex.subjects.PublishSubject;
public class Test {
package com.some.app.common
import io.reactivex.Scheduler
import io.reactivex.android.plugins.RxAndroidPlugins
import io.reactivex.internal.schedulers.ExecutorScheduler
import io.reactivex.plugins.RxJavaPlugins
import io.reactivex.schedulers.TestScheduler
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
"""Script for converting PacktPub ebooks names in current directory.
Usage:
To execute just put script in ebook directory (subdirs will not work).
Todo:
- Detect unsupported or already converted file names.
"""
#!/usr/bin/python3
#-*- encoding: utf-8 -*-
#include <iostream>
#include <fstream>
int main() {
std::fstream plik;
bool pierwszy = true;
if (pierwszy) {
plik.open("file_load.cpp", std::ios::in);
} else {
plik.open("file_load.cpp", std::ios::in);
import android.app.Activity
import android.support.annotation.IdRes
import android.view.View
fun <T : View> Activity.bind(@IdRes idRes: Int): Lazy<T> {
@Suppress("UNCHECKED_CAST")
return unsafeLazy { findViewById(idRes) as T }
}
fun <T : View> View.bind(@IdRes idRes: Int): Lazy<T> {
public class BitmapUtils {
public static Bitmap cropCircleCenterBitmap(Bitmap bitmap) {
int size;
int x;
int y;
// calculate square bitmap
if (bitmap.getWidth() >= bitmap.getHeight()) {
x = bitmap.getWidth() / 2 - bitmap.getHeight() / 2;
y = 0;
size = bitmap.getHeight();
@bholota
bholota / GetterSetterTemplate.java
Created December 14, 2016 15:28
InteliJ getter/setter template for Jackson properties
// JacksonGetter
#set($const_name = $helper.getPropertyName($field, $project).toString().replaceAll("([A-Z]+)","\_$1").toUpperCase())
@JsonProperty(${const_name})
@Nullable
#if($field.modifierStatic)
static ##
#end
$field.type ##
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
#if ($field.boolean && $field.primitive)
@bholota
bholota / Utils.java
Created August 11, 2016 10:07
WannaBeFunctional
private static abstract class Transform1<T, M> {
abstract M transform(T input);
}
private <InputType, OutputType, InputList extends List<InputType>, OutputList extends List<OutputType>> OutputList map (InputList input, Transform1<InputType, OutputType> transform1) {
List<OutputType> out = new ArrayList<>();
for (InputType i : input) {
out.add(transform1.transform(i));
}