Skip to content

Instantly share code, notes, and snippets.

View briancurt's full-sized avatar

Brian Curtich briancurt

View GitHub Profile
@briancurt
briancurt / template_switch.sh
Created September 22, 2021 14:31
Quick and dirty way to convert Ruby/Chef template variables to YAML/Ansible.
# <%= @app['config']['foo'] %>
# to
# {{ app.config.foo }}
for file in $(ls -1 templates/); do
sed -i -e "s/<%= @/{{ /" $file # Replace <%= @ with {{
sed -i -e "s/%>/}}/" $file # Replace %> with }}
sed -i -e "s/\['/./" $file # Replace first occurence of [' with .
sed -i -e "s/'\]\['/./g" $file # Replace all middle '][' with .
sed -i -e "s/'\] / /" $file # Remove closing ']
@briancurt
briancurt / ecr_login
Created April 9, 2020 13:01
AWS ECR login systemd unit and timer
# /etc/systemd/system/ecr_login.service
[Unit]
Description=Docker AWS ECR login daemon
Wants=network-online.target
After=network.target network-online.target docker.service
[Service]
Type=oneshot
User=ubuntu
ExecStart=/bin/bash -c '$$(/usr/bin/aws ecr get-login --no-include-email --region us-east-1)'