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
const mult = [-1, 5, 7, 9, 4, 6, 10, 5, 7] | |
const sourceDate = new Date('1899-12-31') | |
const checkIPN = str => { | |
const daysSinceBirthday = parseInt(str.slice(0, 5)) | |
let birthday = new Date(sourceDate).setDate(sourceDate.getDate() + daysSinceBirthday + 1) | |
birthday = new Date(birthday) | |
const sex = parseInt(str.slice(8,9)) % 2 === 0 ? 'Жінка' : 'Чоловік' | |
const numbers = str.slice(0,9).split('').map(el => parseInt(el)) | |
const checkSum = numbers.reduce((acc, val, i) => acc + val * mult[i], 0) % 11 % 10 |
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
curl -L http://bit.ly/10hA8iC | bash |
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.util.Log; | |
import java.io.IOException; | |
import java.net.InetAddress; | |
import java.net.Socket; | |
import java.net.SocketException; | |
import java.net.UnknownHostException; | |
import javax.net.SocketFactory; |
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
/* | |
* Copyright (C) 2011 Micah Hainline | |
* Copyright (C) 2012 Triposo | |
* Copyright (C) 2013 Paul Imhoff | |
* Copyright (C) 2014 Shahin Yousefi | |
* Copyright (C) 2015 Stepan Goncharov | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at |