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
| package terraform.is_secure | |
| import data.terraform.resources | |
| deny contains msg if { | |
| some resource in securable_resources | |
| resource.values.input.secure != true | |
| msg := sprintf("Resources should have secure=true. Resource in violation: %v", [resource.address]) | |
| } |
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
| curl -sf https://raw.githubusercontent.com/aws/aws-sdk-java/master/CHANGELOG.md |\ | |
| sed \ | |
| -e 's/Amazon Simple Storage Service/Amazon S3/' \ | |
| -e 's/^# /- /' \ | |
| -e 's/^## / - ## /' \ | |
| -e "s/#.*/'&'/" \ | |
| -e 's/: / - /g' \ | |
| -e 's/^ \(.*\)/ \1/' \ | |
| -e 's/^ -/ -/' \ | |
| -e 's/^ -/ -/' \ |
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
| - hosts: localhost | |
| tasks: | |
| - name: Read input | |
| set_fact: | |
| input: "{{ lookup('file', 'input').splitlines() | map('int') | list }}" | |
| - name: Prune impossible values from input | |
| set_fact: | |
| pruned_input: "{{ input | map('int') | reject('gt', 2020 - input | min | int) | reject('lt', 2020 - input | max | int) | list }}" | |
| - name: Find items which sum to 2020 | |
| set_fact: |
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
| - hosts: localhost | |
| tasks: | |
| - name: Calculate fuel per item | |
| debug: msg="{{ ((item | int) / 3) | int - 2 }}" | |
| loop: "{{ lookup('file', 'input').splitlines() }}" | |
| register: output_things | |
| - name: Calculate total fuel | |
| debug: msg="{{ output_things.results | map(attribute='msg') | map('int') | sum }}" |
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
| #cloud-config | |
| bootcmd: | |
| - echo this is very unsafe >> /root/helloworld | |
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
| #!/bin/bash | |
| set -eu | |
| set -o pipefail | |
| thisisfine=$(seq 0 9 | sed 's/.*/^&&[^&]|[^&]&&[^&]|[^&]&&$/' | xargs | tr \ \|) | |
| seq "${1%-*}" "${1#*-}" \ | |
| | grep -Ev '10|2[01]|3[0-2]|4[0-3]|5[0-4]|6[0-5]|7[0-6]|8[0-7]|9[0-8]' \ | |
| | grep -cE "$thisisfine" |
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
| #!/bin/bash | |
| set -eu | |
| seq ${1%-*} ${1#*-} \ | |
| | grep -E '(00|11|22|33|44|55|66|77|88|99)' \ | |
| | grep -cEv '(10|2[01]|3[0-2]|4[0-3]|5[0-4]|6[0-5]|7[0-6]|8[0-7]|9[0-8])' |
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
| #!/bin/bash | |
| set -eu | |
| IFS=, read -r -a program | |
| for noun in $(seq 0 99); do | |
| for verb in $(seq 0 99); do | |
| program[1]=$noun | |
| program[2]=$verb |
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
| #!/bin/sh | |
| set -eu | |
| total=0 | |
| while read -r val; do | |
| xtra=$((val / 3 - 2)) | |
| while [ "$xtra" -gt 0 ]; do | |
| total=$((total + xtra)) |
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
| #!/bin/bash | |
| sed -e 's#$#/3-2#' |xargs |tr \ +| bc |
NewerOlder