Skip to content

Instantly share code, notes, and snippets.

View BrycePearce's full-sized avatar

Bryce Pearce BrycePearce

View GitHub Profile
import fs from "fs";
import path from "path";
const root = "src/localization";
const removeComment = (filePath) => {
const data = fs.readFileSync(filePath);
const json = JSON.parse(data);
Object.entries(json).forEach(([key, value]) => {
'use strict';
let obj = require('./dataOut.json');
var fs = require('fs');
//json variables
let scan_type = obj[0].scan_type;
let date_time = obj[0].date_time;
let source_address = obj[0].source_address;
let source_lat = obj[0].source_lat;
@BrycePearce
BrycePearce / index.js
Created July 25, 2016 15:38
PM 3 datapoints
const fs = require('fs');
const argv = require('yargs').argv;
const ProgressBar = require('progress');
const graph = require('ngraph.graph')();
const createLayout = require('ngraph.offline.layout');
const toBinary = require('ngraph.tobinary');
const file = fs.readFileSync(argv.i, 'utf-8');
const data = file.replace(/ /g, '').split('\r\n');
let current = 0;
/*
this script selects values from database final.smallgraph utilizing the following libraries:
http://expressjs.com/en/guide/routing.html
https://github.com/mysqljs/mysql
*/
let mysql = require('mysql');
let express = require('express');
let app = express();
<?xml version="1.0" encoding="UTF-8"?>
<gexf xmlns="http://www.gexf.net/1.3" version="1.3" xmlns:viz="http://www.gexf.net/1.3/viz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gexf.net/1.3 http://www.gexf.net/1.3/gexf.xsd">
<meta lastmodifieddate="2016-06-13">
<creator>Gephi 0.9</creator>
<description></description>
</meta>
<graph defaultedgetype="directed" mode="static">
<attributes class="node" mode="static">
<attribute id="weighted indegree" title="Weighted In-Degree" type="double">
<default>0.0</default>
'use strict';
let fs = require('fs');
function solution(A)
{
var lines = A.split(/\r?\n/g);
'use strict';
/*
This script parses files, then utilizes the following libraries in order:
1.) https://github.com/anvaka/ngraph.graph x
2.) https://github.com/anvaka/ngraph.offline.layout x(change ngraph.native for million+ node files)
3.) https://github.com/anvaka/ngraph.tobinary x
4.) https://github.com/anvaka/pm
'use strict';
/*
This script parses files, then utilizes the following libraries in order:
1.) https://github.com/anvaka/ngraph.graph
2.) https://github.com/anvaka/ngraph.offline.layout (change ngraph.native for million+ node files)
3.) https://github.com/anvaka/ngraph.tobinary
4.) https://github.com/anvaka/pm
@BrycePearce
BrycePearce / lol.js
Created June 6, 2016 20:26
dont hate me
//this script parses files
//splits on newlines & carriage return + erases whitespace
//don't forget to remove logs after
fs = require('fs');
//require https://github.com/anvaka/ngraph.graph/
var g = require('ngraph.graph')();
var newData;
//var src;
//var dst;
@BrycePearce
BrycePearce / weewoo.js
Created June 6, 2016 19:33
meme dreams
//this script parses files
//splits on newlines & carriage return + erases whitespace
//don't forget to remove logs after
fs = require('fs');
var newData;
//read in the UTF8 data
fs.readFile('data/data.csv', 'utf8', function (err, data) {
//log an error if something goes wrong
if (err) {