This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Demonstration video can be found at: https://youtu.be/roAerKVfq-Y | |
| // StopEC2Instance | |
| const AWS = require('aws-sdk'); | |
| exports.handler = (event, context, callback) => { | |
| const ec2 = new AWS.EC2({ region: event.instanceRegion }); | |
| ec2.stopInstances({ InstanceIds: [event.instanceId] }).promise() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # This script stashes the currently staged changes, and leaves everything else in the working directory as-is. | |
| # (source: https://stackoverflow.com/questions/14759748/stashing-only-staged-changes-in-git-is-it-possible/39644782#39644782) | |
| # Prompt for the desired repo path | |
| REPOPATH= | |
| read -p "Enter the repo path, or press ENTER for current dir: " REPOPATH | |
| # Read the desired stash description from the command line, or prompt the user for it if necessary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Put this in your .gitconfig file under the alias section | |
| orphank = !gitk --all `git reflog | cut -c1-7`& | |
| # Then run it by typing 'git orphank' on the command line. | |
| # A text version of the same is | |
| orphanl = !git --pretty=oneline --abbrev-commit --graph --decorate `git reflog | cut -c1-7` |