Skip to content

Instantly share code, notes, and snippets.

@AMeng
AMeng / jenkins-job.groovy
Last active September 28, 2017 22:04
Jenkins Job DSL Example
job('example-job') {
wrappers {
colorizeOutput()
preBuildCleanup()
}
logRotator {
numToKeep(10)
}
steps {
shell('./gradlew clean build')
@AMeng
AMeng / datadog-alert.yaml
Created September 28, 2017 22:12
DataDog Alert Example
- name: EC2 CPU Utilization
query: avg(last_1h):avg:aws.ec2.cpuutilization by {host} > 95
message: EC2 CPU utilization is {{comparator}} {{threshold}} on host {{host.ip}}.
@AMeng
AMeng / spinnaker-pipeline.json
Created September 29, 2017 00:30
Spinnaker Pipeline Example
{
"app": {
"instance_type": "m4.large",
"app_description": "Edge Forrest Demo application"
},
"asg": {
"min_inst": 2,
"max_inst": 5
}
}
def solution(A):
highest_distance = 0
earliest_seen = {}
for index, value in enumerate(A):
if earliest_seen.get(value):
distance = index - earliest_seen[value] + 1
if distance > highest_distance:
highest_distance = distance
else:
earliest_seen[value] = index + 1