Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
lining up my magnum opus ;-)

Krishnan Mani krishnan-mani

💭
lining up my magnum opus ;-)
View GitHub Profile
@krishnan-mani
krishnan-mani / list_inactive_repos.rb
Created Apr 15, 2015
List inactive repositories for the organisation
View list_inactive_repos.rb
require 'github_api'
require 'date'
puts 'You can obtain your access token from: https://github.com/settings/applications#personal-access-tokens'
puts 'Your Github.com access token:'
GITHUB_PERSONAL_ACCESS_TOKEN = gets.chomp
puts 'Your Github.com organisation:'
github_org = gets.chomp
@krishnan-mani
krishnan-mani / describe-instances-then-stop-them.sh
Created Feb 22, 2018
Describe EC2 instances by filtering on tag values, then stop a list of instances by instance-id
View describe-instances-then-stop-them.sh
$ aws ec2 describe-instances \
--filters "Name=tag:Name,Values=CodeDeployDemo" \
--query "Reservations[*].Instances[*].InstanceId" \
--output text
$ aws ec2 stop-instances --instance-ids i-abc17charsid01 i-def17charsid02 i-pqr17charsid-03
@krishnan-mani
krishnan-mani / put_item_with_ttl.sh
Created Jan 29, 2018
Put an item in DynamoDB with a one day TTL
View put_item_with_ttl.sh
#!/usr/bin/env bash
set -euxo pipefail
TABLE_NAME="$1"
REGION="$2"
NOW_IN_MINUTES=$(date +%Y%m%dT%H%M%z)
EPOCH_TIME=$(date +%s)
ONE_DAY_LATER=$(($EPOCH_TIME+86400))
item={\"id\":{\"S\":\"$NOW_IN_MINUTES\"},\"expireAt\":{\"N\":\"$ONE_DAY_LATER\"},\"hostname\":{\"S\":\"$(hostname)\"}}
View gist:34df77be1277415edb8930f5a8f22352
rules.append({
'NoncurrentVersionExpiration' : {
'NoncurrentDays' : XYZ
},
'Status' : 'Enabled',
'Prefix' : prefix})
@krishnan-mani
krishnan-mani / gist:ee3c3e97b9ab3e685ac771818ec16f7e
Created Nov 8, 2016
elastic beanstalk deployment (from Jenkins)
View gist:ee3c3e97b9ab3e685ac771818ec16f7e
#!/bin/bash -l
cd ${WORKSPACE}/api
virtualenv venv-api
source venv-api/bin/activate
pip install awsebcli
eb init -r ${AWS_REGION}
eb deploy
View count_spec.rb
require 'aws-sdk'
class MetricsWriter
def initialize(connection_info)
@client = Aws::DynamoDB::Client.new(connection_info)
ensure_tables
end
def ensure_tables
View DevOpsTuesdays.md

#DevOps Tuesdays!

What?

  • Sign up to pair with Krishnan (and others) to work on real-world DevOps tasks one day of the week every week, and get going with specific knowledge, skills, and practice!

When?

  • Every Tuesday (or another day of the week in the event that holidays or vacation intervene). So there's always something happening every Tuesday, and some Tuesdays, you'll be knee-deep in it!

How?

  • We’ll pick people at random and let you know beforehand. No pre-requisites whatsoever!