Skip to content

Instantly share code, notes, and snippets.

View koenongena's full-sized avatar

Koen Ongena koenongena

View GitHub Profile
@timyates
timyates / excel.groovy
Last active May 15, 2024 14:01
Create a styled Excel spreadsheet with Groovy and Apache POI
@Grab( 'org.apache.poi:poi:3.9' )
import static org.apache.poi.ss.usermodel.CellStyle.*
import static org.apache.poi.ss.usermodel.IndexedColors.*
import org.apache.poi.hssf.usermodel.HSSFWorkbook
new HSSFWorkbook().with { workbook ->
def styles = [ LIGHT_BLUE, LIGHT_GREEN, LIGHT_ORANGE ].collect { color ->
createCellStyle().with { style ->
fillForegroundColor = color.index
fillPattern = SOLID_FOREGROUND
@crazy4groovy
crazy4groovy / csv2List.groovy
Last active March 9, 2021 20:50
A Groovy script that takes a CSV filePath (string), and turns it into a List of Maps (via groovycsv lib).
@Grab('com.xlson.groovycsv:groovycsv:1.0')
import com.xlson.groovycsv.CsvParser
// a normally parsed csv can only be searched through ONCE
// this is used to create a "re-searchable" object (List of Maps)
List<Map> csv2List( String filePath, boolean shouldTrim = true, String charset = 'UTF-8' ) {
new File( filePath ).withReader(charset) { r ->
new CsvParser().parse( r ).with { csv ->
return csv.collect { line ->
line.columns.collectEntries { c, v ->
@jirutka
jirutka / -README.md
Last active October 31, 2023 09:07
How to use terminal on Windows and don’t go crazy…

How to use terminal on Windows without going crazy…

Windows is really horrible system for developers and especially for devops. It doesn’t even have a usable terminal and shell, so working with command line is really pain in the ass. If you really don’t want to switch to any usable system (OS X, Linux, BSD…), then this guide should help you to setup somewhat reasonable environment – usable terminal, proper shell, ssh client, git and Sublime Text as a default editor for shell.

Install stuff

  1. Download and install Git for Windows* with:
    • [✘] Use Git from the Windows Command Prompt
  • [✘] Checkout as-is, commit Unix-style line endings