This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
import groovy.xml.XmlUtil | |
import javax.net.ssl.SSLSession | |
import javax.net.ssl.HostnameVerifier | |
import javax.net.ssl.SSLContext | |
import javax.net.ssl.HttpsURLConnection | |
import static javax.net.ssl.HttpsURLConnection.HTTP_OK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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: ", ") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let numbers = Application('Numbers') | |
numbers.includeStandardAdditions = true | |
numbers.activate() | |
delay(1) | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//debugger; | |
'use strict'; | |
var mailboxName = '[email protected]' | |
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env osascript -l JavaScript | |
function run( argv ) { | |
'…Your cxode here…' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env groovy | |
//@GrabConfig(systemClassLoader=true) | |
@Grab(group='ch.qos.logback', module='logback-classic', version='1.2.3') | |
@Grab(group='org.apache.pdfbox', module='pdfbox', version='2.0.11') | |
@Grab(group='commons-io', module='commons-io', version='2.6') | |
import org.apache.pdfbox.pdfwriter.* | |
import org.apache.pdfbox.pdmodel.* | |
import org.apache.pdfbox.pdmodel.font.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
@Grab(group='com.googlecode.gbench', module='gbench', version='0.4.2-groovy-2.3') | |
import groovyx.gbench.BenchmarkBuilder | |
def charGen = { String alphabet, int n -> | |
new Random().with { | |
(1..n).collect { alphabet[ nextInt( alphabet.length() ) ] }.join() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
import groovy.xml.XmlUtil | |
import javax.net.ssl.SSLSession | |
import javax.net.ssl.HostnameVerifier | |
import javax.net.ssl.SSLContext | |
import javax.net.ssl.HttpsURLConnection | |
import static javax.net.ssl.HttpsURLConnection.HTTP_OK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env groovy | |
class LatLng{ | |
/* | |
Latitude is written before longitude. Latitude/Longitude is written with a decimal number. | |
Latitude is decimal number rangeing from positive to negative (north and south of the Equator) | |
Longitude is decimal number rangeing from positive to negative (negative is west of Greenwich and positive is eastward of Greenwich) | |
Latitude is the Y axis, Longitude is the X axis. | |
*/ |