This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
import argparse | |
import fnmatch | |
import os | |
import pathlib | |
import cv2 | |
def files_recursively(dir_path, pattern="*.png"): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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 -*- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
} |