<commit_before>var https = require('https');
var async = require('async');
var cfg = require('./config');
var mongoose = require('mongoose');
var models = require('./models')(mongoose);
var Gist = models.Gist;

mongoose.connect(cfg.mongo.connection_string);

Gist.Gist.find(function (err, gists) {
    if(err) {
        throw err;
    }

    async.eachSeries(gists, function (gist, done) {

        var gistDeletePostOptions = {
            host: 'api.github.com',
            port: 443,
            path: '/gists/' + gist.id,
            method: 'DELETE',
            headers: {
                'Authorization': 'token ' + cfg.github_token,
                'Content-Type': 'application/json; charset=UTF-8'
            }
        };

        var req = https.request(gistDeletePostOptions, function (res) {
            res.setEncoding('utf8');

            if(res.statusCode === 204) {
                console.log('deleted gist id: ' + gist.id);
                done();
            }
            else {
                done({statusCode: res.statusCode});
                return;<commit_msg>added comments to the main routine<commit_after>var https = require('https');
var async = require('async');
var cfg = require('./config');
var mongoose = require('mongoose');
var models = require('./models')(mongoose);
var Gist = models.Gist;

mongoose.connect(cfg.mongo.connection_string);

/*
  Read all the gist records from the database and delete them on GitHub Gist
  The StatusCode for successful deletion is 204
*/
Gist.Gist.find(function (err, gists) {
    if(err) {
        throw err;
    }

    async.eachSeries(gists, function (gist, done) {

        var gistDeletePostOptions = {
            host: 'api.github.com',
            port: 443,
            path: '/gists/' + gist.id,
            method: 'DELETE',
            headers: {
                'Authorization': 'token ' + cfg.github_token,
                'Content-Type': 'application/json; charset=UTF-8'
            }
        };

        var req = https.request(gistDeletePostOptions, function (res) {
            res.setEncoding('utf8');

            if(res.statusCode === 204) {
                console.log('deleted gist id: ' + gist.id);
                done();
            }
            else {
                done({statusCode: res.statusCode});
                return;
{'fraction_non_alphanumeric': 0.13390557939914163, 'fraction_numerical': 0.00815450643776824, 'mean_word_length': 1.9247176913425346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '2568774', 'n_tokens_mistral': 695, 'n_tokens_neox': 666, 'n_words': 153}