git checkout -b otherrepo-master mastergit pull https://github.com/otherrepo/my-repo-name.git master| // From: https://www.freecodecamp.org/news/how-to-delete-a-git-branch-both-locally-and-remotely/ | |
| // delete branch locally | |
| git branch -d localBranchName | |
| // delete branch remotely | |
| git push origin --delete remoteBranchName |
| $ git checkout -b your-branch | |
| $ tox | |
| $ cd <path to terraform directory> | |
| $ terragrunt init | |
| $ terragrunt plan -out plan.file | |
| $ git push | |
| $ terraform show -no-color plan.file | pbcopy |
| git rebase -i HEAD~2 | |
| git checkout master | |
| git pull | |
| git checkout ssharma-addname | |
| git rebase -i master | |
| git rebase --continue | |
| git add <FILENAME> | |
| git rebase --continue |
| CREATE USER admin WITH PASSWORD 'admin'; | |
| CREATE DATABASE api_db; | |
| ALTER ROLE admin SET timezone TO 'UTC'; | |
| ALTER ROLE admin SET default_transaction_isolation TO 'read committed'; | |
| GRANT ALL PRIVILEGES ON DATABASE api_db TO admin; |
| import datetime | |
| datetime.date.today().replace(day=1) - datetime.timedelta(days=1) |
| # find the compatible version of the client here: https://github.com/Homebrew/homebrew-core/search?q=kubernetes-helm&type=Commits | |
| brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/dddb831d66da48588fc3efbcec0508155af9e16a/Formula/kubernetes-helm.rb | |
| brew switch kubernetes-helm 2.15.2 | |
| brew link kubernetes-cli | |
| brew unlink kubernetes-helm && brew link kubernetes-helm | |
| docker inspect --format='{{.State.StartedAt}}' <containerid> | xargs date +%s -d |
| class CommentsSerializer(serializers.ModelSerializer): | |
| jid = serializers.CharField(required=True) | |
| # having required=False allows the field details to be absent from the data when constructing the serializer. | |
| # e.g. s = SerializerA(data={}) | |
| # whereas allow_null permits the the param to be specified but be null. | |
| j_s_id = serializers.CharField(required=False, allow_null=True) | |
| comment = serializers.CharField(required=True) | |
| created_by = serializers.HiddenField( | |
| default=serializers.CurrentUserDefault() | |
| ) |
| ## This works in the case of multiple databases and data with no primary keys | |
| class CommentsSerializer(serializers.ModelSerializer): | |
| somefield = serializers.CharField(required=True) | |
| comment = serializers.CharField(required=True) | |
| created_by = serializers.HiddenField( | |
| default=serializers.CurrentUserDefault() | |
| ) | |
| def validate_somefield(self, value): |