Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew McClenaghan andymac4182

View GitHub Profile
View Brewfile
tap "aws/tap"
tap "common-fate/granted"
tap "gjbae1212/gossm"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/services"
tap "tedsmitt/ecsgo"
View Template.service
[Unit]
Description=SERVICENAME
[Service]
WorkingDirectory=#{Octopus.Action.Package.InstallationDirectoryPath}
ExecStart=#{Octopus.Action.Package.InstallationDirectoryPath}/SERVICENAME
Restart=always
RestartSec=10
User=ec2-user
Environment=HOSTNAME=#{Octopus.Machine.Name}
View Shared.sh
describe-target-health() {
aws elbv2 describe-target-health --target-group-arn $1 --targets Id=$2
}
targetGroup=$( get_octopusvariable "AWSELBv2ARN" )
if [ -z "$targetGroup" ];
then
echo Target Group is missing
exit 1
fi
View PostDeploy.sh
#!/bin/bash
source Shared.sh
aws elbv2 register-targets --target-group-arn $targetGroup --targets Id=$instanceId
describe-target-health $targetGroup $instanceId
aws elbv2 wait target-in-service --target-group-arn $targetGroup --targets Id=$instanceId
describe-target-health $targetGroup $instanceId
View PreDeploy.sh
#!/bin/bash
source Shared.sh
aws elbv2 deregister-targets --target-group-arn $targetGroup --targets Id=$instanceId
describe-target-health $targetGroup $instanceId
aws elbv2 wait target-deregistered --target-group-arn $targetGroup --targets Id=$instanceId
describe-target-health $targetGroup $instanceId
View Deploy.sh
#!/bin/bash
packageId=$( get_octopusvariable "Octopus.Action.Package.PackageId" )
echo Package Id is $packageId
chmod +x $packageId
if [ -e /lib/systemd/system/$packageId.service ]
then
echo stopping service
View cloudwatch-logs-subscription-filter-template.json
{
"Type": "AWS::Logs::SubscriptionFilter",
"DependsOn": "LoggingLambdaPermission",
"Properties": {
"LogGroupName": "LogGroup",
"FilterPattern": "{ $.HaHaThisIsJson NOT EXISTS }",
"DestinationArn": {
"Fn::GetAtt": [
"LoghandlerLambdaFunction",
"Arn"
View NpmInstallRecursive.js
var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;
var walk = function(dir, done) {
var results = [];
fs.readdir(dir, function(err, list) {
if (err) return done(err);
var pending = list.length;
if (!pending) return done(null, results);
View SerilogLinqpad.cs
void Main()
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Warning()
.Enrich.FromLogContext()
.Enrich.WithProperty("url", "http://serilog.net/")
.WriteTo.Sink(new LingpadDumpSink())
.CreateLogger();
Log.Warning(
"Processing inside {@test}, something weird happened",
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: