Skip to content

Instantly share code, notes, and snippets.

def lines = new File('/Users/mmally/temp/bash_history_merged').readLines()
def entries = new TreeMap<Long, String>()
def text = lines
.collate(2)
.collectEntries(entries) { time, cmd ->
[(time - '#').toLong(), cmd]
}.collectMany { k, v ->
["#$k", v]
}.join('\n')
@michal-mally
michal-mally / MotoGPCalendarImport.groovy
Created March 3, 2017 18:11
Downloads MotoGP calendar and produces gcalcli's commands to add all the events to Google Calendar.
import org.apache.commons.codec.digest.DigestUtils
import org.apache.commons.lang3.StringUtils
import org.htmlcleaner.HtmlCleaner
import org.htmlcleaner.TagNode
import java.time.ZonedDateTime
import java.util.concurrent.TimeUnit
String download(String url) {
def md5 = DigestUtils.md5Hex(url)