Skip to content

Instantly share code, notes, and snippets.

View rudchenkos's full-sized avatar

Sergii Rudchenko rudchenkos

View GitHub Profile
@rudchenkos
rudchenkos / CenterCropDrawable.java
Created July 14, 2017 12:47
Maintain aspect ratio of bitmap drawables set as windowBackground on Android
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
module Language.Dutch.Telwoorden where
telwoord :: Integer -> String
telwoord 0 = "nul"
telwoord 1 = "een"
telwoord 2 = "twee"
telwoord 3 = "drie"
telwoord 4 = "vier"
telwoord 5 = "vijf"
telwoord 6 = "zes"
@rudchenkos
rudchenkos / FindFiles.hs
Created April 20, 2018 06:16
Microframework for file search
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
module Main where
import Data.Monoid
import System.Directory
import System.FilePath
import Control.Monad (filterM)
import System.Process (callProcess)
@rudchenkos
rudchenkos / sha1sum.c
Last active April 20, 2018 06:37
Fast SHA1 calculation on files
/* cc -Wpedantic sha1sum.c -osha1sum $(shell pkg-config --cflags --libs libcrypto) */
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <openssl/sha.h>
#include <stdio.h>