Skip to content

Instantly share code, notes, and snippets.

View novice81's full-sized avatar

Wook-Jin, Lee novice81

  • Helsinki, Finland
View GitHub Profile
@novice81
novice81 / aws-list-ec2.sh
Created October 28, 2020 09:49
Show EC2 list
aws ec2 describe-instances \
--filter Name=tag-key,Values=Name \
--query 'Reservations[*].Instances[*].{Instance:InstanceId,AZ:Placement.AvailabilityZone,Name:Tags[?Key==`Name`]|[0].Value,DNS_Pub:PublicDnsName, DNS_Pri:PrivateDnsName}' \
--output table \
$@
@novice81
novice81 / assume-role.sh
Created March 11, 2020 11:42
AWS CLI to assume role
#!/bin/bash
$PROFILE_NAME="user-has-assume-role"
$ROLE_ARN="role-arn-that-has-policies-to-work"
$SESSION_NAME="session-name-to-identify"
export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id --profile $PROFILE_NAME)
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key --profile $PROFILE_NAME)
unset AWS_SESSION_TOKEN
@novice81
novice81 / commit-walk.sh
Last active March 6, 2020 18:55
Walk on commits one by one
#!/bin/bash
# Reset to initial commit
git log --format=%H origin/master | tail -1 | xargs git reset --hard
# checkout one by one
git log --format=%H HEAD..origin/master | tail -1 | xargs git checkout
@novice81
novice81 / .gitconfig.alias
Last active July 17, 2020 11:26
Git Alias
[alias]
lg = log --oneline --graph -10
lgm = log --oneline --graph master..HEAD
lgn = log --name-only -1
st = status
pf = push --force
bd = branch -D
bdr = push origin --delete
bl = branch --list
blr = branch --list --remote