Skip to content

Instantly share code, notes, and snippets.

View hussfelt's full-sized avatar
:shipit:
All in - no fold.

Henrik Hussfelt hussfelt

:shipit:
All in - no fold.
View GitHub Profile
@hussfelt
hussfelt / README.md
Last active April 2, 2024 21:25
AWS and Terraform: Simplest redirect possible for redirecting traffic from one domain to another

AWS and Terraform site redirect

Using example.com as the input domain, this module will:

  • Create a Route53 zone for example.com
  • Create a bucket named example.com
  • Create a bucket named www.example.com
  • Create a Route53 A record example.com for the static website bucket of example.com
  • Create a Route53 A record www.example.com for the static website bucket of www.example.com
@hussfelt
hussfelt / gist:911c58fd668ba422b688
Last active December 10, 2023 12:46 — forked from kjunggithub/gist:8330157
git hubflow cheaetsheet

Git HubFlow Cheat Sheet

Preparing the repository

Create the repository on GitHub/Bitbucket. Once created, clone the created repository to your local machine using:

git clone git@github.com:username/repository.git

CD into the repository folder and run the init command to enable to hub flow tools:

cd repo_name
@hussfelt
hussfelt / README.md
Last active October 13, 2022 07:03
Dashing widget to display an iframe with specified src

dashing-iframe

IFrame plugin for dashing

Description

Dashing widget to display an iframe with specified src

Installation

Create the folder iframe in the /widgets/ directory. Put the files iframe.coffee, iframe.html and iframe.scss in that folder.

@hussfelt
hussfelt / README.md
Last active July 23, 2020 18:13
How to configure ECS EC2 instances to authenticate to JFrog Artifactory Docker Registry

How to configure ECS EC2 instances to authenticate to JFrog Artifactory Docker Registry

The JFrog documentation is lacking on how to do this in a proper way, expecting to use the normal procedures for logging into docker and not in an automated way. This gets even worse if you try and configure your task to authenticate to a private registry - which does not seem to be possible.

The solution is to adjust your user-data, preferably storing your config and key in Secrets Manager.

Putting the config into Secret Manager:

aws secretsmanager update-secret --secret-id artifactory --region us-west-1 --secret-string '{"https://companyname-repo-virtual.jfrog.io": {"auth": "AUTHKEY_FROM_SETMEUP","email": "EMAIL_FROM_SETMEUP"}}'
@hussfelt
hussfelt / README.md
Created October 15, 2018 19:53
Use Terraform and Lambda to automatically purge old IAM user passwords and access keys

Purge IAM secrets

This terraform module and lambda will remove passwords and secrets that have been unused for too long.

Usage

Put the files in a module folder, for example modules/purge-iam-secrets Use module like this within your terraform plan:

Keybase proof

I hereby claim:

  • I am hussfelt on github.
  • I am hussfelt (https://keybase.io/hussfelt) on keybase.
  • I have a public key ASACMdnwf32QEUF_xGwRo3zNswIMoUAoyBPuzZm0jGAwsAo

To claim this, I am signing this object:

from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
@hussfelt
hussfelt / deploy.sh
Created October 22, 2012 11:29
Minimal Race-free Deployment
#!/bin/sh
# deploy.sh
N="`readlink \"$1\"`"
mv -T "$1.stage" "$1"
ln -s "$N" "$1.stage"
rm -rf "$N"
cp -aH "$1" "$N"
@hussfelt
hussfelt / gist:3246917
Created August 3, 2012 11:54 — forked from ffub/gist:1084424
Balsamiq HTML export
#!/usr/bin/php
<?php
error_reporting(E_ALL);
if (count($argv) <= 1) {
print("usage createMockup src_dir dst_dir images_dir\n");
print("\tsrc_dir : dir where all bmml file are\n");
print("\tdst_dir : dir where write all html files\n");
print("\timages_dir : dir where all export mockup png are (will be copied to the \$dst_dir/images directory)\n");
exit(1);
}
@hussfelt
hussfelt / example_serializer.js
Created August 17, 2015 18:48
Implementation of the new rest-serializer converting data to JSONApi 2.0
import DS from 'ember-data';
import rest_serializer from 'app/mixins/serializers/rest';
export default DS.RESTSerializer.extend(rest_serializer, {
/**
* [normalizeSingleResponse description]
* @param {[type]} store [description]
* @param {[type]} primaryModelClass [description]
* @param {[type]} payload [description]