Skip to content

Instantly share code, notes, and snippets.

View yyunikov's full-sized avatar

Yuriy Yunikov yyunikov

View GitHub Profile
@yyunikov
yyunikov / ObjectIdUtils.java
Created January 15, 2015 15:04
Example of generating unique id's using sha256
public final class ObjectIdUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(ObjectIdUtils.class);
private static final char[] BASE36 = {
'0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', 'A', 'B',
'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T',
@yyunikov
yyunikov / ErrorHandler.java
Last active August 29, 2015 14:14
Example of error handling for Java web applications
@WebServlet("/error")
public class ErrorHandler extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
processError(request, response);
}
protected void doPost(HttpServletRequest request,
package com.pixite.fragment.widget;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.view.Gravity;
@yyunikov
yyunikov / PermissionUtils.java
Created February 18, 2016 10:20
Useful methods for requesting permissions on Android 6.0 and above
public final class PermissionUtils {
private PermissionUtils() {}
public static void askPermissionIfNeeded(@NonNull final Activity activity,
@NonNull final View layoutView,
@StringRes final int message,
final int requestCode,
@NonNull final String[] permissions) {
if (!permissionsGranted(activity, permissions)) {
@yyunikov
yyunikov / multiple_ssh_setting.md
Created May 18, 2016 11:15 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@yyunikov
yyunikov / StringBruteForceGenerator.java
Created January 15, 2017 15:26
Brute force generator for different types of charsets
public class StringBruteForceGenerator {
public static final char[] CYRILLIC_CHARSET = "абвгдеєжиіїйклмнопрстуфхцчшщьюя".toCharArray();
private char[] charset;
public StringBruteForceGenerator(final char[] charset) {
this.charset = charset;
}
@yyunikov
yyunikov / kube.sh
Created May 15, 2018 05:24 — forked from gjyoung1974/kube.sh
Initialize Minikube - Local Kubernetes cluster on macOS
#!/bin/bash
export KUBECONFIG=$HOME/.kube/config
#Download an OSX binary minikube
# minikube-darwin-amd64
#
# https://github.com/kubernetes/minikube/releases
# Put it somewhere that you can run it from: /usr/local/bin/minikube && chmod +x /usr/local/bin/minikube
# Download Docker Machine Hyperkit Driver
@yyunikov
yyunikov / keybase.md
Created May 19, 2020 12:50
Keybase Verification

Keybase proof

I hereby claim:

  • I am yyunikov on github.
  • I am yyunikov (https://keybase.io/yyunikov) on keybase.
  • I have a public key whose fingerprint is 2A00 D425 978F 8360 7DF7 8DE0 044D 39FD 2C2B E011

To claim this, I am signing this object:

@yyunikov
yyunikov / do_init.txt
Last active March 4, 2022 14:37
Digital Ocean Init
#!/bin/bash
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg