Skip to content

Instantly share code, notes, and snippets.

Marcus Gelderman marcgeld

Block or report user

Report or block marcgeld

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
marcgeld / .bash_profile
Last active May 25, 2019
macOS bash_profile
View .bash_profile
export PATH="/usr/local/sbin:$PATH"
export PATH=$PATH:$M2_HOME/bin
export GROOVY_HOME=/usr/local/opt/groovy/libexec
export GOPATH="${HOME}/.go:${HOME}/devmap/go"
export PATH="$PATH:${GOPATH}/bin"
function setjdk() {
marcgeld / pdfImages2MultipageTIFF.groovy
Created Apr 21, 2019
Extract images from a pdf file to multipage TIFF (Tesseract-ocr accepts multipage TIFF, but not a pdf file with images as input)
View pdfImages2MultipageTIFF.groovy
#!/usr/bin/env groovy
// Java 9 or later (…for the TIFF ImageIO Plugin)
@Grab(group='ch.qos.logback', module='logback-classic', version='1.2.3')
@Grab(group='org.apache.pdfbox', module='pdfbox', version='2.0.15')
@Grab(group='commons-io', module='commons-io', version='2.6')
import org.apache.pdfbox.pdfwriter.*
import org.apache.pdfbox.pdmodel.*
marcgeld / springboot.groovy
Created Apr 16, 2019
A very simple Spring Boot Application in groovy
View springboot.groovy
#!/usr/bin/env groovy
package myapp
marcgeld / booleanToString.groovy
Last active Apr 3, 2019
boolean to string conversion (Java/Groovy)
View booleanToString.groovy
#!/usr/bin/env groovy
Boolean TRUE = true
Boolean FALSE = false
println "Boolean true => string: '${Boolean.toString(TRUE)}'"
println "Boolean false => string: '${Boolean.toString(FALSE)}'"
println "String 'true' => string: '${Boolean.parseBoolean("true")}'"
println "String 'TRUE' => string: '${Boolean.parseBoolean("TRUE")}'"
marcgeld / httpsPost.groovy
Last active Mar 27, 2019
Post to
View httpsPost.groovy
#!/usr/bin/env groovy
import groovy.xml.XmlUtil
import static
marcgeld / collectionUInt8Extension.swift
Last active Apr 3, 2019
make a hex String from a UInt8 collection
View collectionUInt8Extension.swift
// Array of [UInt8] to hex String extension
// let arr = [0x03, 0x00, 0x02, 0x05, 0x11, 0x25, 0xa0, 0xfe, 0xe5] as [UInt8]
// let hex = arr.hexValueString (hex is the result)
extension Collection where Element == UInt8 {
var hexValueString: String {
return map{ String(format: "0x%02x", $0) }.joined(separator: ", ")
marcgeld / numberToNumbers.scpt
Last active Sep 24, 2018
A jxa script to create a spreadsheet in Apple numbers
View numberToNumbers.scpt
let numbers = Application('Numbers')
numbers.includeStandardAdditions = true
SystemEvents = Application('System Events')
Notes = SystemEvents.processes['Numbers']
let jsonStr = "[{\"datum\":\"26 januari 2018 16:28\",\"biljett\":\"Enkelbiljett\",\"pris\":\"39,00\",\"moms\":\"2,21\",\"total\":\"39,00\"},{\"datum\":\"24 januari 2018 17:09\",\"biljett\":\"Enkelbiljett\",\"pris\":\"39,00\",\"moms\":\"2,21\",\"total\":\"39,00\"},{\"datum\":\"20 januari 2018 16:14\",\"biljett\":\"Enkelbiljett\",\"pris\":\"47,00\",\"moms\":\"2,66\",\"total\":\"47,00\"},{\"datum\":\"14 januari 2018 02:17\",\"biljett\":\"Enkelbiljett\",\"pris\":\"27,00\",\"moms\":\"1,53\",\"total\":\"27,00\"},{\"datum\":\"13 januari 2018 18:06\",\"biljett\":\"Enkelbiljett\",\"pris\":\"27,00\",\"moms\":\"1,53\",\"total\":\"27,00\"},{\"datum\":\"22 december 2017 14:22\",\"biljett\":\"Enkelbiljett\",\"pris\":\"46,00\",\"moms\":\"2,60\",\"total\":\"46,00\"},{\"datum\":\"21 december 2017 17:20\",\"biljett\":\"Enkelbiljett\",\"pr
marcgeld / calculate-payroll.scpt
Created Sep 18, 2018 — forked from reinvented/calculate-payroll.scpt
JXA Scripting of, using AJAX to calculate payroll deductions from a remote PHP script
View calculate-payroll.scpt
Numbers = Application('Numbers');
Numbers.includeStandardAdditions = true
var table = Numbers.documents[0].sheets[0].tables[0]
var selectedRow = table.selectionRange().cells[0];
var hoursCellRow = selectedRow.row().address();
var weekEndingCell = table.ranges["B" + hoursCellRow + ":B" + hoursCellRow].cells[0];
var nameCell = table.ranges["C" + hoursCellRow + ":C" + hoursCellRow].cells[0];
marcgeld / vasttrafikmail.scpt
Created Sep 17, 2018
jxa: Find and filter emails in macOS from Create json output with extracted information.
View vasttrafikmail.scpt
'use strict';
var mailboxName = ''
var mail = new Application("Mail")
var account = mail.accounts.whose({ name: { _contains: mailboxName } }, {ignoring: 'case'})
var mailbox = account.mailboxes.whose({ name: { _contains: 'INBOX' } }, {ignoring: 'case'})
// var messages = mail.selection();
marcgeld /
Created Sep 17, 2018
macOS: run osxscript as shell script
#!/usr/bin/env osascript -l JavaScript
function run( argv ) {
'…Your cxode here…'
You can’t perform that action at this time.