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
| # change prefix command to C-z | |
| set -g prefix C-z | |
| unbind C-b | |
| bind C-z last-window | |
| bind z send-prefix | |
| # setup | and - for window splitting | |
| unbind % | |
| bind | split-window -h | |
| bind - split-window -v |
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 | |
| # Create a new directory and enter it | |
| function mkd() { | |
| mkdir -p "$@" && cd "$_"; | |
| } | |
| # Change working directory to the top-most Finder window location | |
| function cdf() { # short for `cdfinder` | |
| cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')"; |
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
| #cite 'about-alias' | |
| #about-alias 'common git abbreviations' | |
| # Aliases | |
| alias gcl='git clone' | |
| alias ga='git add' | |
| alias gall='git add .' | |
| alias gus='git reset HEAD' | |
| alias gm="git merge" | |
| alias g='git' |
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
| alias dkprune="docker image prune" | |
| alias dki="docker images" | |
| alias dkps="docker ps" | |
| alias dkpsa="docker ps -a" | |
| alias dkstop="docker stop" | |
| alias dkrmi="docker rmi" | |
| alias dkexec="docker exec" | |
| alias dkc="docker-compose" | |
| alias dkcu="docker-compose up" | |
| alias dkcd="docker-compose down" |
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
| def assume_role(arn, session_name): | |
| """aws sts assume-role --role-arn arn:aws:iam::00000000000000:role/example-role --role-session-name example-role""" | |
| client = boto3.client('sts') | |
| account_id = client.get_caller_identity()["Account"] | |
| print(account_id) | |
| response = client.assume_role(RoleArn=arn, RoleSessionName=session_name) | |
| session = Session(aws_access_key_id=response['Credentials']['AccessKeyId'], |
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
| def setup_s3_client(job_data): | |
| """Creates an S3 client | |
| Uses the credentials passed in the event by CodePipeline. These | |
| credentials can be used to access the artifact bucket. | |
| :param job_data: The job data structure | |
| :return: An S3 client with the appropriate credentials | |
| """ |
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 python3 | |
| class dotdict(dict): | |
| """dot.notation access to dictionary attributes""" | |
| __getattr__ = dict.get | |
| __setattr__ = dict.__setitem__ | |
| __delattr__ = dict.__delitem__ | |
| mydict = {'val':'it works'} | |
| nested_dict = {'val':'nested works too'} | |
| mydict = dotdict(mydict) |
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 python3 | |
| #coding=utf-8 | |
| # -------------------------------------------------------------------- | |
| # An example hook script to verify what is about to be committed. | |
| # Called by "git commit" with no arguments. The hook should | |
| # exit with non-zero status after issuing an appropriate message if | |
| # it wants to stop the commit. | |
| # | |
| # To enable this hook, rename this file to "pre-commit". | |
| # |
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
| # Login first with Connect-AzureRmAccount if not using Cloud Shell | |
| $azContext = Get-AzureRmContext | |
| $azProfile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile | |
| $profileClient = New-Object -TypeName Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient -ArgumentList ($azProfile) | |
| $token = $profileClient.AcquireAccessToken($azContext.Subscription.TenantId) | |
| $authHeader = @{ | |
| 'Content-Type'='application/json' | |
| 'Authorization'='Bearer ' + $token.AccessToken | |
| } |
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
| #!/bin/bash | |
| # install dotnet core | |
| sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list' | |
| sudo apt-get update | |
| sudo apt-get install -y apt-transport-https jq vim | |
| sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893 | |
| sudo apt-get install -y dotnet-sdk-2.1.103 --allow-unauthenticated | |
| sudo apt-get install -y dotnet-sharedframework-microsoft.netcore.app-1.1.2 --allow-unauthenticated |