Skip to content

Instantly share code, notes, and snippets.

@alanghans
alanghans / json2sqlite.lua
Last active August 29, 2015 14:26 — forked from ers35/json2sqlite.lua
Convert http://redd.it/3bxlg7 to an SQLite database
-- The author disclaims copyright to this source code.
-- Convert http://redd.it/3bxlg7 to an SQLite database
-- Convert the whole dataset at once like so:
-- find reddit_data -type f -exec time lua json2sqlite.lua {} \;
local cjson = require"cjson"
local sqlite = require"lsqlite3"
local db = sqlite.open("reddit_data.db")
db:exec[[
@alanghans
alanghans / json_to_csv.html
Last active August 29, 2015 14:26 — forked from palesz/json_to_csv.html
JSON to CSV converter
<html>
<head>
<style>
textarea {
height: 300px;
width: 100%;
}
</style>
<script type="text/javascript">
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
year|album|artist
1955|In The Wee Small Hours|Frank Sinatra
1956|Ellington at Newport _56|Duke Ellington
1956|Elvis Presley|Elvis Presley
1956|Songs For Swingin' Lovers|Frank Sinatra
1956|Birth of the Cool|Miles Davis
1956|Tragic Songs Of Life|The Louvin Brothers
1957|The Atomic Mr Basie|Count Basie
1957|This is Fats Domino|Fats Domino
1957|Here_s Little Richard|Little Richard