Profile cover photo
Profile photo
Sergei Sizov
Software Engineer
Software Engineer
About
Sergei's posts

Post has attachment
Easy password hash migration from MD5 to BCrypt.
Many legacy production systems still use non-salted MD5 function for password hashing. These hashes are usually stored in the database and used for user authentication. The problem is that non-salted MD5 hash is no more secure today. There are so-called rai...

Post has attachment
Alexander Goldstein's Each! Pattern
class Array def each! while count > 0 yield (shift) end end end

Post has attachment
SelectionSort in Java
public static void selectionsort(int[] A) {
for (int i = 0; i < A.length; i++) {
int min = i;
for (int j = i+1; j < A.length; j++) {
if (A[j] < A[min]) {
min = j;
}
}
swap(A, i, min);
}
}

public static void swap(int[] A, int ...

Post has attachment
InsertionSort in Java
public static void insertionsort(int[] A) {
for (int i = 1; i < A.length; i++) {
for (int j = i; j > 0 && A[j] < A[j - 1]; j--) {
swap(A, j, j - 1);
}
}
}

public static void swap(int[] A, int i, int j) {
int temp = A[j];
A[j] = A[i];
...

Post has attachment
MergeSort in Java
public static void mergesort(int[] A) {
int[] aux = new int[A.length];
mergesort(A, aux, 0, A.length-1);
}
private static void mergesort(int[] A, int[] aux, int lo, int hi) {
if (lo >= hi) return;
int m = (lo+hi) / 2;
mergesort(A, aux, lo, m);
...

Post has attachment
QuickSort in Java
public static void quicksort(int[] A) {
quicksort(A, 0, A.length-1);
}

private static void quicksort(int[] A, int lo, int hi) {
if (lo >= hi) return;
int p = partition(A, lo,hi);
quicksort(A, lo, p-1);
quicksort(A, p+1, hi);
}

private stat...

Post has attachment
Python: SFTP with Paramiko via SOCKS proxy
I use Paramiko library to access SFTP servers in Python. Paramiko is easy to use, provides programmer with rich functionality, but it does not support proxy servers out of the box. There is a small library socksipy that can be easily integrated with Paramik...

Post has attachment
Kerberos Windows configuration for Java 7
After migrating to Java 7, our Java client application was unable to authenticate via Kerberos on Windows. If you have the same problem, the following configuration may help you solve it. There is a key allowtgtsessionkey in Windows registry that allows cli...

Post has attachment

Post has attachment
Wait while more posts are being loaded