7 Commits

Author SHA1 Message Date
gauthiier 2485023cee Staging main script for export 2015-05-25 21:48:05 +02:00
gauthiier a3cc75c3ec Exported files (bis) 2015-05-25 21:37:42 +02:00
gauthiier 2cf8123025 Exported files 2015-05-25 21:31:32 +02:00
gauthiier 56806a0bef Added export script and dependencies 2015-05-25 21:27:37 +02:00
gauthiier 3b1bca9c41 Performing Scripts
git and html scripts
2015-05-25 20:45:58 +02:00
gauthiier 474b259cef .gitignore 2015-05-21 21:33:08 +02:00
gauthiier 53848f1a11 cleanup 2015-05-12 20:55:44 +02:00
51 changed files with 444 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
node_modules

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 182 KiB

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

+69
View File
@@ -0,0 +1,69 @@
var fs = require('fs')
var gs = require('ghostscript')
var path = require('path')
var reckon_path = "."
var export_path = "export"
var index_name = "index.json"
if(!fs.existsSync(export_path))
fs.mkdirSync(export_path);
var index = [];
var index_path = path.join(export_path, index_name);
if(fs.existsSync(index_path))
index = JSON.parse(fs.readFileSync(index_path, 'utf8'));
fs.readdir(reckon_path, function(err, files) {
if(err)
throw err;
files.map(function (f) {
return {"name" : f, "path" : path.join(reckon_path, f)};
}).filter(function (f) {
return (fs.statSync(f.path).isFile() && path.extname(f.path) === '.pdf' && !exists(f.name));
}).forEach(function (f) {
var img_fname = extract_img(f.path);
var entry = {}
entry.name = f.name;
entry.imgs = [];
entry.imgs.push(img_fname);
index.push(entry);
})
var index_content = JSON.stringify(index, null, 2);
fs.writeFile(index_path, index_content, function(err) {
if(err) return console.log(err);
console.log(index_path + '>' + index_content);
});
});
function extract_img(file) {
var out_name = path.basename(file) + ".png"
var out = path.join(export_path, out_name);
gs()
.batch()
.quiet()
.nopause()
.device('pngalpha')
.input(file)
.output(out)
.r(72)
.spawn();
return out_name;
}
function exists(fname) {
for (var e in index) {
if(index[e].name === fname)
return true;
}
return false;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

+146
View File
@@ -0,0 +1,146 @@
[
{
"name": "A Spreadsheet Way of Knowledge — Backchannel — Medium.pdf",
"imgs": [
"A Spreadsheet Way of Knowledge — Backchannel — Medium.pdf.png"
]
},
{
"name": "Adding Machines.pdf",
"imgs": [
"Adding Machines.pdf.png"
]
},
{
"name": "Barnes_Alan Kay-Transforming the Computer into a Communication Medium_2007.pdf",
"imgs": [
"Barnes_Alan Kay-Transforming the Computer into a Communication Medium_2007.pdf.png"
]
},
{
"name": "Capurro_Past present and future of the concept of information_2009.pdf",
"imgs": [
"Capurro_Past present and future of the concept of information_2009.pdf.png"
]
},
{
"name": "Copeland_Computation_2004.pdf",
"imgs": [
"Copeland_Computation_2004.pdf.png"
]
},
{
"name": "Gilles Deleuze - The Exhausted.pdf",
"imgs": [
"Gilles Deleuze - The Exhausted.pdf.png"
]
},
{
"name": "Grier-CarpetForcomputingRoom.pdf",
"imgs": [
"Grier-CarpetForcomputingRoom.pdf.png"
]
},
{
"name": "History of Computation - 16-19th Century Work.pdf",
"imgs": [
"History of Computation - 16-19th Century Work.pdf.png"
]
},
{
"name": "Leibniz_ArithmetiqueBinaire.pdf",
"imgs": [
"Leibniz_ArithmetiqueBinaire.pdf.png"
]
},
{
"name": "MR1418.deviates.pdf",
"imgs": [
"MR1418.deviates.pdf.png"
]
},
{
"name": "National Research Counil bibliography of mathematical tables and other aids to computation_1939.pdf",
"imgs": [
"National Research Counil bibliography of mathematical tables and other aids to computation_1939.pdf.png"
]
},
{
"name": "Pickering_The Cybernetic Brain Sketches of Another Future_2010 copy.pdf",
"imgs": [
"Pickering_The Cybernetic Brain Sketches of Another Future_2010 copy.pdf.png"
]
},
{
"name": "Prentice_Calculating machines calculating women-redesigning astronomical and scientific computation in Britian 1915-1946_2000.pdf",
"imgs": [
"Prentice_Calculating machines calculating women-redesigning astronomical and scientific computation in Britian 1915-1946_2000.pdf.png"
]
},
{
"name": "RCA_Tables of Trigonometric Functions and Non-sexagesimal arguements_1943.pdf",
"imgs": [
"RCA_Tables of Trigonometric Functions and Non-sexagesimal arguements_1943.pdf.png"
]
},
{
"name": "Skinner_The age of the female computers_2006.pdf",
"imgs": [
"Skinner_The age of the female computers_2006.pdf.png"
]
},
{
"name": "Turing_Computing machinery and intelligence_1950_ORIGINAL.pdf",
"imgs": [
"Turing_Computing machinery and intelligence_1950_ORIGINAL.pdf.png"
]
},
{
"name": "Turing_On Computable Numbers_1936.pdf",
"imgs": [
"Turing_On Computable Numbers_1936.pdf.png"
]
},
{
"name": "VonNeumann-EDVAC-2003-08-TheFirstDraft.pdf",
"imgs": [
"VonNeumann-EDVAC-2003-08-TheFirstDraft.pdf.png"
]
},
{
"name": "VonNeumann56-LOGIC-AUTOMATA-ERROR-REDUNDANCY.pdf",
"imgs": [
"VonNeumann56-LOGIC-AUTOMATA-ERROR-REDUNDANCY.pdf.png"
]
},
{
"name": "VonNeumann_PlanningCoding.pdf",
"imgs": [
"VonNeumann_PlanningCoding.pdf.png"
]
},
{
"name": "Wikipedia_Computational Logic.pdf",
"imgs": [
"Wikipedia_Computational Logic.pdf.png"
]
},
{
"name": "Women Computers in World War II - GHN: IEEE Global History Network.pdf",
"imgs": [
"Women Computers in World War II - GHN: IEEE Global History Network.pdf.png"
]
},
{
"name": "computation-OED.pdf",
"imgs": [
"computation-OED.pdf.png"
]
},
{
"name": "reckon, v. : Oxford English Dictionary.pdf",
"imgs": [
"reckon, v. : Oxford English Dictionary.pdf.png"
]
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

+141
View File
@@ -0,0 +1,141 @@
var nodegit = require('nodegit')
var path = require('path')
var fs = require('fs')
var all = []
var git_data = []
var cnt = 0;
var export_path = 'export';
//var export_path = '/Users/gauthiier/Desktop/vbox/reckon_export/export';
var export_index_fname = 'index.json';
var export_index = null;
var template = '';
var imgs_list_ext_valid = ['.png', '.jpeg', '.jpg', '.gif']
fs.readFile('template.html', 'utf8', function(err, data) {
if(err) console.log(err);
template = data;
});
// hmm...
var export_index_path = path.join(export_path, export_index_fname);
if(fs.existsSync(export_index_path))
export_index = JSON.parse(fs.readFileSync(export_index_path, 'utf8'));
nodegit.Repository.open(path.resolve(__dirname, './.git'))
.then(function(repo) {
return repo.getBranchCommit('prototype');
})
.then(function(first_commit) {
var history = first_commit.history(nodegit.Revwalk.SORT.REVERSE);
//var history = first_commit.history(nodegit.Revwalk.SORT.TIME);
history.on("commit", function(commit) {
var entry = {};
entry.commit = commit.sha();
entry.author = commit.author().name();
entry.date = commit.date();
entry.raw = commit.rawHeader();
entry.message = commit.message().replace('\n', ' — ');
entry.files = [];
commit.getTree()
.then(function (tree) {
var entries = tree.entries();
for(e in entries) {
var ep = entries[e].path();
if(all.indexOf(ep) != -1) continue;
all.push(ep);
entry.files.push(ep);
}
});
git_data.push(entry);
});
history.on("end", function() {
var body = '';
git_data.reverse();
for(var i in git_data)
body += emit_git_entry(git_data[i]);
console.log(template.replace('[[_export_]]', body));
});
history.start();
})
.done();
function emit_git_entry(entry) {
var html = '<!-- entry #' + cnt++ + ' -->\n';
html += '<entry>\n'
html += ' <commit><h1>Commit: ' + entry.commit + '</h1></commit>\n';
html += ' <commit>' + entry.date + '</commit>\n';
html += ' <message><h2>' + entry.message + '</h2></message>\n';
html += ' <content>\n';
for(var q in entry.files) {
html += ' ' + emit_git_content(entry.files[q]);
}
html += ' </content>\n';
return html + '</entry>\n'
}
function emit_git_content(c) {
if(!fs.existsSync(path.join('.', c))) return '';
if(!fs.statSync(path.join('.', c)).isFile()) return '';
var ext = path.extname(c);
if(imgs_list_ext_valid.indexOf(ext) != -1)
return '<a href="' + c + '"><img src="' + c + '"/></a>\n';
else if(ext === '.pdf') {
return '<a href="' + c + '">' + emit_git_content_pdf(c) + '</a>';
} else {
return '<a href="' + c + '">' + c + '</a>\n';
}
}
function emit_git_content_pdf(c) {
var index = exists(c);
if(!index) return '';
return '<img src="' + path.join(export_path, index.imgs[0]) + '"/>\n';
}
/// hmmm....
function exists(fname) {
if(!export_index) return null;
for (var e in export_index) {
if(export_index[e].name === fname)
return export_index[e];
}
return null;
}

Before

Width:  |  Height:  |  Size: 408 KiB

After

Width:  |  Height:  |  Size: 408 KiB

+31
View File
@@ -0,0 +1,31 @@
{
"name": "reckon",
"version": "0.0.0",
"description": "Reckoning Histories of Computation",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/gauthiier/reckon.git"
},
"keywords": [
"Arcades",
"Project"
],
"author": "gauthiier",
"license": "ISC",
"bugs": {
"url": "https://github.com/gauthiier/reckon/issues"
},
"homepage": "https://github.com/gauthiier/reckon",
"dependencies": {
"ghostscript": "https://github.com/gauthiier/node-ghostscript/tarball/master",
"nodegit": "^0.4.0"
},
"scripts" : {
"export": "node export.js",
"index": "node index.js > index.html"
}
}
+43
View File
@@ -0,0 +1,43 @@
body {
font-family: "Times New Roman", Times, Georgia, serif;
background-color: #ffff99;
bbackground-color: #e9d6a8;
bbackground-color: #eeeeee;
}
#listing {
width: 100%;
}
#title {
margin-left: auto;
margin-right: auto;
text-align: center;
margin: 3em;
}
entry {
display: block;
width: 75%;
border: 1px solid grey;
min-width: 650px;
margin-top: 0.6em;
padding: 0.6em;
background-color: #ffffcc;
margin-left: auto;
margin-right: auto;
}
commit {
display: block;
}
content {
display: block;
}
content img {
max-width: 300px;
border: 1px solid grey;
background-color: white;
}
View File

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 171 KiB

+13
View File
@@ -0,0 +1,13 @@
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="reckon.css"/>
<title>Performing Histories of Computation</title>
</head>
<body>
<div id="listing">
<div id="title"><h1>Performing Histories of Computation</h1></div>
[[_export_]]
</div>
</body>
</html>