Skip to content

Instantly share code, notes, and snippets.

View EwanDawson's full-sized avatar

Ewan Dawson EwanDawson

  • Ping Identity
  • Edinburgh, UK
View GitHub Profile
@EwanDawson
EwanDawson / tg2p.st
Created November 27, 2020 22:49 — forked from jdevoo/tg2p.st
Not so Terse Guide to Pharo
"**************************************************************************
* Allowable characters: *
* - a-z *
* - A-Z *
* - 0-9 *
* - .+/\*~<>@%|&? *
* - blank, tab, cr, ff, lf *
* *
* Variables: *
* - variables must be declared before use *
@EwanDawson
EwanDawson / id_dsa.pub
Created July 26, 2020 12:32
PGP Public Key ewan@lazygun.net
ssh-dss AAAAB3NzaC1kc3MAAACBAJ/6aLJY6KF/DvtDN1Oj9r0c/kZUTFNE9+desknea18ohgVaL0vhPRmsikKWgNN9YUpNNCbQevs6pUIHckittTd1HZBid5+9yt5QgJsvZpPyNIuwCTPbTXtP9Eb5CYL20PLs4rAD/h2RPG1Wf3KEf1jeKKNhZLwkPovqERi7EvvFAAAAFQCvNfhgWpptLU17Mi6jXpj/MWAiSQAAAIA9BrVEV2khNbCepgkf/ntTT1XtBZq52eSXlYYYbDSTddL3Svl+WCPn4fSnTYMx8GZ3xy52xuX7M3DqAe7QEGWl9NqEFT6D4Qx6sYhArnjl7qmYPiQp1DMTSA+jmBa4UgggsullbWA7xSweJxFQZSvj/itWuB2bcgFUD030kdPRzwAAAIB2FFcZnNbd0OrvKSUc/UieNpFdOJOIcJTOFfHxBAjvk5mNm3OL/QSZOIDep/a45gzy4h4pezcG3sFhtT0SeDxsmfHjxbY14IoOY1gF1uDLpSref1GuU06nCSborlqiPudrPsmIoGX0gWpKPnUkSCbFxiGZS/RTliV51pOq6NTg/g== ewan@lazygun.net
@EwanDawson
EwanDawson / reclaimWindows10.ps1
Last active April 26, 2018 17:38 — forked from alirobe/reclaimWindows10.ps1
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults)
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Modified by: alirobe <alirobe@alirobe.com> based on my personal preferences.
# Version: 2.12.1, 2018-03-15
# Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
# Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/
# Tweak difference:
#
# @alirobe's version is a subset focused on safely disabling telemetry, some 'smart' features and 3rd party bloat ...

Keybase proof

I hereby claim:

  • I am ewandawson on github.
  • I am lazygun (https://keybase.io/lazygun) on keybase.
  • I have a public key ASAHjm5FBY9_oTxwdB2moVUn8_PqKEBpmSOJsoT39mYlPQo

To claim this, I am signing this object:

@EwanDawson
EwanDawson / transform.groovy
Created July 19, 2017 03:31
Transform a collection by applying a function to each element
//Transform collection in payload[0]
//by passing element to script named in payload[1]
payload[0]
.collect { invoke(payload[1], it) }
.collect { it.get() }
_Sent from my OnePlus ONEPLUS A5000 using [FastHub](https://play.google.com/store/apps/details?id=com.fastaccess.github)_
@EwanDawson
EwanDawson / date-to-epoch-nanos.groovy
Created July 18, 2017 20:59
Convert a date into the number of nanoseconds elapsed from January 1, 1970 UTC to that date
import java.time.Instant
def instant = Instant.parse(payload[0] as String)
instant.epochSecond * 1e9 + instant.nano
@EwanDawson
EwanDawson / timeseries-write.groovy
Last active July 18, 2017 18:08
Writes one or more data poins to an instance of InfluxDB running on localhost port 8086
@Grapes([
@Grab("com.jcabi:jcabi-http:1.17.1"),
@Grab("javax.json:javax.json-api:1.0"),
@Grab("org.glassfish:javax.json:1.0.4"),
@Grab("org.hamcrest:hamcrest-library:1.3"),
@Grab("org.hamcrest:hamcrest-core:1.3"),
@Grab("javax.ws.rs:javax.ws.rs-api:2.0.1")
])
import com.jcabi.http.request.JdkRequest
import com.jcabi.http.response.RestResponse
import java.time.LocalDateTime
import static java.time.temporal.ChronoField.*
def now = LocalDateTime.now()
def everySecond = { it() }
def everyMinute = { if (now.get(SECOND_OF_MINUTE) == 0) it() }
def everyHour = { if (now.get(SECOND_OF_MINUTE) == 0 && now.get(MINUTE_OF_HOUR) == 0) it() }
def alert = { title, message -> invoke('https://gist.githubusercontent.com/EwanDawson/a65e720ed8ce0c9bc26d816de71ee776/raw/af0fa90ea080c758fec4077cd927dd1bd3d3da92/alert-me.groovy', [title, message]) }
everyMinute { alert("The time is now", now.toString()) }
@Grapes(@Grab("com.jcabi:jcabi-http:1.17.1"))
import com.jcabi.http.request.JdkRequest
import static java.net.URLEncoder.encode
def (title, message) = payload.collect { encode(it).replaceAll("\\+", "%20") }
new JdkRequest("https://api.simplepush.io/send/jzAa6m/${title.toUpperCase()}/$message").fetch()
@Grapes(@Grab(group='org.atteo', module='evo-inflector', version='1.2.2'))
import org.atteo.evo.inflector.English
English.plural(payload[0], payload[1] ?: 2)