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
#include <string> | |
#include <fstream> | |
#include <vector> | |
#include <sstream> | |
#include <algorithm> | |
#include <stdexcept> | |
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) { | |
std::stringstream ss(s); | |
std::string item; |
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
module IpToCountry | |
open System | |
open System.IO | |
type CountryCode = { code : string } | |
type IpAddressMapping = { cc : CountryCode; startAddress : uint32; } | |
/// Class to store the IP-addresses in 255 different buckets | |
/// countryIpList = The list of IP address mappings to store in this intance |
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
module IpToCountry | |
open System | |
open System.IO | |
/// Construct new class for mapping ip addresses to countries using | |
/// database from http://software77.net/geo-ip/ | |
type IpToCountrySlow(?fileName) = | |
let fileName = defaultArg fileName "IpToCountry.csv" | |
// Read all non-comment lines |
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
open System | |
/// Finnish social security number calculator in F# | |
/// Suomalainen henkilötunnuslaskuri F#:lla | |
module SSN = | |
let getSeparator year = | |
if year < 1900 then '+' | |
else if year < 2000 then '-' | |
else 'A' |
NewerOlder