From 65b0e6fa9e07b7e77681534ed8af39a9bb195416 Mon Sep 17 00:00:00 2001 From: abregman Date: Sat, 9 Jul 2022 00:23:21 +0300 Subject: [PATCH] Update --- resources/aws.md | 6 ++++++ resources/git.md | 5 +++++ resources/github.md | 29 +++++++++++++++++++++++++++++ resources/linux.md | 5 +++++ resources/python.md | 15 ++++++++++++++- 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 resources/github.md diff --git a/resources/aws.md b/resources/aws.md index 329534f..a8e6b2a 100644 --- a/resources/aws.md +++ b/resources/aws.md @@ -86,3 +86,9 @@ aws ec2 authorize-security-group-ingress \ --port 80 \ --cidr 0.0.0.0/0 ``` + +### RDS + +* Encryption in PostgreSQL: `rds.force_ssl=1 (parameter groups)` +* Encryption in MySQL: `GRANT USAGE ON *.* TO 'mysqluser'@'%' REQUIRE SSL;` + diff --git a/resources/git.md b/resources/git.md index 6bd0e87..3440fce 100644 --- a/resources/git.md +++ b/resources/git.md @@ -47,3 +47,8 @@ Name | Comments git revert --no-commit X..HEAD git commit ``` + +#### References + +* All references in current repository: `find .git/refs/` +* Update master reference: `git update-ref refs/heads/master ` diff --git a/resources/github.md b/resources/github.md new file mode 100644 index 0000000..9f75738 --- /dev/null +++ b/resources/github.md @@ -0,0 +1,29 @@ +# GitHub + +## Common Issues + +* 'can't sync because main is not tracking [PROJECT NAME]' + +This happens the branch is no longer tracking main from upstream. Can be fixed with this command: `git push --set-upstream origin main`. + +## Cheat Sheet + +### Repository + +* Clone repository: `gh clone ` +* Sync your fork from source repo: `gh repo sync --source /` + +### Pull Requests + +* Create PR: `gh pr create --title "Some Pull Request ;)` +* List PRs: `gh pr list` +* Change to PR (aka checkout): `gh pr checkout ` +* Update PR: `git push` + +### CI + +* List builds/workflow runs: `gh run list` + +### Rebase + +* Rebase current branch commits on top of latest changes in main branch: `git rebase origin/main` diff --git a/resources/linux.md b/resources/linux.md index cbc3065..82da616 100644 --- a/resources/linux.md +++ b/resources/linux.md @@ -111,6 +111,11 @@ sudo ausearch -m avc -m user_avc -m selinux_err -m user_selinux_err -i -ts today * Sort files by size: `ls -l | sort -nk5` * Find broken links: `find /some/path -type l -exec test ! -e {} \; -print` +#### YAML + +* Validate YAML file with Ruby: `ruby -ryaml -e "p YAML.load(STDIN.read)" < some_file.yaml` +* Validate YAML file with Python: `pip install pyyaml; python -c 'import yaml, sys; print(yaml.safe_load(sys.stdin))' < some_file.yaml` + #### Misc * Generate 8 digit random number: `shuf -i 9999999-99999999 -n 1` diff --git a/resources/python.md b/resources/python.md index dd92c14..d5a6543 100644 --- a/resources/python.md +++ b/resources/python.md @@ -43,7 +43,7 @@ Megha Mohan | [Mutable vs Immutable Objects in Python](https://medium.com/@megha Kenneth Reitz | [The Hitchhiker’s Guide to Python](http://docs.python-guide.org/en/latest) | | | Kenneth Reitz | [Serialization](https://docs.python-guide.org/scenarios/serialization/) | | | -## Frameworks & Tools +## Libraries, Frameworks & Tools Name | Description :------:|:-------: @@ -51,6 +51,7 @@ Name | Description [Flask](http://flask.pocoo.org) | Web microframework based on Werkzeug, Jinja 2 [Django](https://www.djangoproject.com) | Web framework with batteries included [Mypy](http://mypy-lang.org) | Static type checker +[Pandas](https://pandas.pydata.org) | "open source data analysis and manipulation tool" ### Cheat Sheet @@ -73,6 +74,18 @@ with Connection(host) as conn: ... ``` +#### Dictionaries + +* Define dictionary: `some_dict = {'first_number': 2017, 'second_number': 2022}` +* Add item to dictionary: `some_dict['third_number'] = 1991` +* Remove last item: `some_dict.popitem()` +* Remove item by key: `some_dict.pop("third_number")` +* Get all keys without values: `some_dict.keys()` +* Get all values without keys: `some_dict.values()` +* Access item: `some_dict['first_number']` or `some_dict.get('second_number')` +* Number of items in the dictionary: `len(some_dict)` +* Update value of a certain key: `some_dict.update({"first_number": 02017}) + ## Python Checklist