Skip to content

Instantly share code, notes, and snippets.

View aeischeid's full-sized avatar

Aaron Eischeid aeischeid

View GitHub Profile
@aeischeid
aeischeid / dataMove.js
Last active May 28, 2021 15:50
a node script that is a good example of moving data from a postgres DB and routing it on to a REST API
const axios = require("axios");
const fs = require("fs");
const asyncPool = require("tiny-async-pool");
const { Pool } = require("pg");
// db connection
// the location the partial animal records will come FROM
// in this case any prod_like replica would work - only condition is the addition of the is_migrated col to the schema
const pool = new Pool({
user: "someDbAdmin",
@aeischeid
aeischeid / makePngFromPdf.groovy
Created May 25, 2021 19:25
use pdfBox library to render a pdf file as a png.
import java.awt.image.BufferedImage
import javax.imageio.ImageIO
import groovy.transform.CompileStatic
// pdfbox imports
import org.apache.pdfbox.cos.*
import org.apache.pdfbox.pdmodel.*
import org.apache.pdfbox.pdmodel.common.*
import org.apache.pdfbox.rendering.PDFRenderer
class PdfService {
@aeischeid
aeischeid / SpreadsheetBuilder.groovy
Last active August 29, 2015 14:21
Utilize Apache POI to output spreadsheets
package gvl.ss
import org.apache.poi.ss.usermodel.*
import org.apache.poi.hssf.usermodel.*
//import org.apache.poi.xssf.usermodel.*
//import org.apache.poi.POIXMLDocument
class SpreadsheetBuilder {
/* Builds a new .xls file from well formatted data array
@aeischeid
aeischeid / AuthToken.groovy
Last active August 29, 2015 14:07
SpringSecurity Rest Plugin Gorm Setup
package org.some.place
class AuthToken {
String tokenValue
String username
Date refreshed = new Date()
static constraints = {
}
Include =
savePrevious: ->
@constructor.records[@id].previousAttributes = @attributes()
revertChanges: ->
if @previousAttributes
@aeischeid
aeischeid / ErrorController.groovy
Last active May 28, 2019 16:08
Alternate grails controller template and url mapping for adding a scaffolded JSON API
package gvl
import grails.converters.JSON
class ErrorController {
// Forbidden
def error403() {
withFormat {
html { render(view: 'error403') }