Skip to content

Instantly share code, notes, and snippets.

public byte[] generateFile(File file, long size) throws IOException, NoSuchAlgorithmException {
Random random = new Random();
byte[] data = new byte[1024];
if (!file.exists()) {
file.createNewFile();
}
try (FileOutputStream outStream = new FileOutputStream(file)) {
for (int j = 0; j < size / 1024; j++) {
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<body>
<input type="file" id="theFile" />
<image id="myimage" />
<script type="text/javascript">
document.getElementById('theFile').addEventListener('change', example);
function example(evt) {
var files = evt.target.files;
Sub updateFormulsTextSyle()
On Error Resume Next
Dim F As Word.Field
Dim N1 As Long, N2 As Long
Application.ScreenUpdating = False
N1 = 0: N2 = 0: N3 = ActiveDocument.Fields.Count
percent = ""
@kolipass
kolipass / dictionary.txt
Created November 12, 2015 13:06
252 russian surnames
Абрамов
Авдеев
Агафонов
Аксёнов
Александров
Алексеев
Андреев
Анисимов
Антонов
Артемьев
@kolipass
kolipass / app_build.gradle
Last active October 15, 2015 04:59
> lombok/ast/Node : Unsupported major.minor version 52.0
//it is app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
public static Subscription action() {
return Observable.create(new LoadConfig())
.subscribe(new Action1<Config>() {
@Override
public void call(Config config) {
if (config.nedToUpdate()) {
//данных нет обновляемся
update();
} else {
if (config.nedToBeSend()) {
@kolipass
kolipass / HoleSurfaceView.java
Created April 28, 2015 04:23
HoleSurfaceView for make vignette effect
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.util.AttributeSet;
import android.view.SurfaceView;
public class HoleSurfaceView extends SurfaceView {