Skip to content

Instantly share code, notes, and snippets.

View DavidBerdik's full-sized avatar

David Berdik DavidBerdik

  • Duquesne University | Ex-Amazonian
  • Pittsburgh, PA, USA
View GitHub Profile
@DavidBerdik
DavidBerdik / split.py
Created April 20, 2020 00:12
Python script to generate a JGAAP-Compatible Corpus CSV from a CSV of authors and their text.
# Example Usage: python split.py yourInputCSVHere.csv
import csv, sys
incsv = open(sys.argv[1], 'r')
outcsv = open('new-' + sys.argv[1], 'w')
counter = 1
csvreader = csv.reader(incsv, delimiter=',', quotechar='"')
for row in csvreader:
outcsv.write(str(row[0]) + ',file' + str(counter) + '.txt,file' + str(counter) + '.txt by ' + str(row[0]) + '\n')
doc = open('file' + str(counter) + '.txt', 'w')
doc.write(row[1])
@DavidBerdik
DavidBerdik / bit2bmp.c
Last active March 27, 2019 13:29
Experimental Bitmap Image Generator from Binary Data, written by Noah Greenberg (@digicannon)
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma pack(push, 1)
struct BMP {
uint8_t id1;
uint8_t id2;
uint32_t filesize;