<commit_before>console.time("Start database");
console.log("Starting database");
var config = require("./config");
var massive = require("massive");
var async = require("async");
var gm = require("gm");
var db = massive.connectSync({connectionString : config('pg_url')}) 
console.timeEnd("Start database");
function createCode() {
	// http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
	return (Math.random().toString(36)+'00000000000000000').slice(2, 5+2).toUpperCase()
}

function codeMaker(number, callback) {
	var code = createCode()
	db.codes.save({code: code}, function(err) {
		callback();
	});
	generateImageWithCode(code);
}

function generateImageWithCode(code) {
	gm("./art/back-master.png").fill('#FFFFFF')
	    .drawText(0, 1000, code, 'Center')
	    .font('./art/CircularStd-Bold.otf')
	    .fontSize( '300px' )
	    .write( "cards/" + code + ".png", function (err) {
	        if (err) {
	            throw err;
	        } 
	    });
}

function doneWithCodes() {
	console.log(config("numberOfCodes") + " codes generated and saved.");
}

// generates as many codes 
async.times(config("numberOfCodes"), codeMaker, doneWithCodes);<commit_msg>fix merge conflict<commit_after>console.time("Start database");
console.log("Starting database");
var config = require("./config");
var massive = require("massive");
var async = require("async");
var gm = require("gm");
var db = massive.connectSync({connectionString : config('pg_url')}) 
console.timeEnd("Start database");
function createCode() {
	// http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
	return (Math.random().toString(36)+'00000000000000000').slice(2, 5+2).toUpperCase()
}

function codeMaker(number, callback) {
	var code = createCode()
	db.codes.save({code: code}, function(err) {
		callback();
	});
	generateImageWithCode(code);
}

function generateImageWithCode(code) {
	gm("./art/back-master.png").fill('#FFFFFF')
	    .drawText(0, 515, code, 'Center')
	    .font('./art/CircularStd-Bold.otf')
	    .fontSize( '180px' )
	    .write( "cards/" + code + ".png", function (err) {
	        if (err) {
	            throw err;
	        } 
	    });
}

function doneWithCodes() {
	console.log(config("numberOfCodes") + " codes generated and saved.");
}

// generates as many codes 
async.times(config("numberOfCodes"), codeMaker, doneWithCodes);
{'fraction_non_alphanumeric': 0.18038237738985868, 'fraction_numerical': 0.03117206982543641, 'mean_word_length': 4.360801781737194, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2662408', 'n_tokens_mistral': 842, 'n_tokens_neox': 770, 'n_words': 147}