{"id":25693538,"url":"https://github.com/dusanmadar/tips-tricks-configs","last_synced_at":"2026-05-17T08:33:41.633Z","repository":{"id":89825627,"uuid":"196826461","full_name":"DusanMadar/tips-tricks-configs","owner":"DusanMadar","description":"Tips, Tricks, Configs, Links to Articles, Repos, ...","archived":false,"fork":false,"pushed_at":"2023-11-17T16:04:01.000Z","size":60,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-11-17T17:31:21.241Z","etag":null,"topics":["config","python","tips","tricks","vscode"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DusanMadar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-07-14T11:08:19.000Z","updated_at":"2023-04-10T19:40:18.000Z","dependencies_parsed_at":"2023-11-17T17:31:04.713Z","dependency_job_id":"1bf38e9d-7982-49ab-9e9e-9a8d793f0053","html_url":"https://github.com/DusanMadar/tips-tricks-configs","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DusanMadar%2Ftips-tricks-configs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DusanMadar%2Ftips-tricks-configs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DusanMadar%2Ftips-tricks-configs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DusanMadar%2Ftips-tricks-configs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DusanMadar","download_url":"https://codeload.github.com/DusanMadar/tips-tricks-configs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240576477,"owners_count":19823291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","python","tips","tricks","vscode"],"created_at":"2025-02-24T23:38:45.272Z","updated_at":"2026-05-17T08:33:36.614Z","avatar_url":"https://github.com/DusanMadar.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tips-Tricks-Configs\nThings which I want to have the same on all machines and I use often but cannot remember or find interesting (worth noting).\n\n* [Docker](#docker)\n* [Git](#git)\n* [Python](#python)\n  * [Async](#async)\n  * [Debugging](#debugging)\n  * [Django](#django)\n  * [Environment](#environment)\n  * [Generators](#generators)\n  * [Testing](#testing)\n* [Resources](#resources)\n  * [SW Development](#sw-development)\n* [Ubuntu](#ubuntu)\n  * [Fresh install](#fresh-install)\n  * [Gnome shortcuts](#gnome-shortcuts)\n* [PostgreSQL](#postgresql)\n* [Rpi](#rpi)\n\n\n## Docker\n* [Remove dangling images](https://gist.github.com/anildigital/862675ec1b7bccabc311)\n  ```\n  docker rmi $(docker images -q -f dangling=true)\n  ```\n* https://medium.com/@tonistiigi/advanced-multi-stage-build-patterns-6f741b852fae\n  * Multi stage build patterns\n* https://medium.com/better-programming/about-var-run-docker-sock-3bfd276e12fd\n  * Intro to `/var/run/docker.sock`\n* https://nickjanetakis.com/blog/best-practices-when-it-comes-to-writing-docker-related-files\n  * Best Practices When It Comes to Writing Docker Related Files\n* https://jtreminio.com/blog/traefik-on-docker-for-web-developers/\n  * Intro to [Traefik](https://traefik.io/) (+explanation)\n\n## Git\n* [4 branching workflows for Git](https://medium.com/@patrickporto/4-branching-workflows-for-git-30d0aaee7bf)\n  * [What is the difference between `git merge` and `git merge --no-ff`?](https://stackoverflow.com/q/9069061/4183498)\n* [Show the git branch with colours in Bash prompt](https://askubuntu.com/q/730754/355551)\n* [Temporarily switch to a different commit](http://stackoverflow.com/a/4114122/4183498)\n  ```\n  git checkout -b {branch name} {commit hash}\n  ```\n* [Delete branch both locally and remotely](http://stackoverflow.com/q/2003505/4183498)\n  ```\n  git branch -D {local branch}\n  git push {remote} --delete {branch name}\n  ```\n* [Reset local changes to match remote branch](http://stackoverflow.com/q/1628088/4183498)\n  ```\n  git fetch origin\n  git reset --hard origin/{branch name}\n  ```\n* Date ordered log for a given author\n  ```\n  git log --date-order --author=\"{author name}\"\n  ```\n* [Point local branch to a remote branch](http://stackoverflow.com/q/1184518/4183498)\n  ```\n  git checkout {local branch}\n  git branch -u {remote}/{remote branch}\n  ```\n\n  There are two options when pushing local branch to the remote's master branch\n  * [Specify branch mapping](http://stackoverflow.com/a/5423655/4183498)\n    ```\n    git push {remote} {local branch name}:master\n    ```\n  * [Change the default _git push_ behavior](http://stackoverflow.com/q/948354/4183498)\n    ```\n    git config push.default upstream\n    ```\n\n\n## Python\n\n### Async\n* [Python \u0026 Async Simplified](https://www.aeracode.org/2018/02/19/python-async-simplified/)\n\n### Debugging\n* [Execute multi-line statements within PDB](http://stackoverflow.com/q/5967241/4183498)\n  ```python\n  (pdb) !import code; code.interact(local=vars())\n  ```\n### Django\n* DB and ORM\n  * [Database access optimization](https://docs.djangoproject.com/en/dev/topics/db/optimization/)\n  * [Solving Performance Problems in the Django ORM](https://medium.com/@hansonkd/performance-problems-in-the-django-orm-1f62b3d04785)\n  * [Using signals is an antipattern](https://www.django-antipatterns.com/antipattern/signals.html)\n  * [Avoid Django’s GenericForeignKey](https://lukeplant.me.uk/blog/posts/avoid-django-genericforeignkey/)\n  * [Django migrations without downtimes](https://pankrat.github.io/2015/django-migrations-without-downtimes/)\n* Translations\n  * [Part V – Internationalization and Localization. Languages and Time zones](http://www.marinamele.com/taskbuster-django-tutorial/internationalization-localization-languages-time-zones)\n  * [Django translation tutorial](http://joaoventura.net/blog/2016/django-translation/)\n  * [Django site with 2 languages](https://stackoverflow.com/q/10280881/4183498)\n  * [Getting started with translating a Django Application](https://blog.braham.biz/getting-started-with-translating-a-django-application-d85ec34e505)\n\n\n### Environment\n* [How do you set your pythonpath in an already-created virtualenv?](https://stackoverflow.com/q/4757178/4183498)\n  ```\n  add2virtualenv /path/to/target/dir\n  ```\n* [How do I find the location of my Python site-packages directory?](https://stackoverflow.com/q/122327/4183498)\n  ```bash\n  python -m site\n  ```\n\n### Generators\n* https://rickardlindberg.me/writing/bitten-by-python-generators/\n\n### Testing\n* [Mocking a context manager](http://stackoverflow.com/q/28850070/4183498)\n* [Mock yourself, not your tests](http://hernantz.github.io/mock-yourself-not-your-tests.html)\n* [Fast Test, Slow Test](https://www.youtube.com/watch?v=RAxiiRPHS9k)\n* [Boundaries](https://www.youtube.com/watch?v=eOYal8elnZk)\n\n* [How to automatically run tests when there's any change in my project (Django)?](https://stackoverflow.com/q/15166532/4183498])\n  ```bash\n  find . -name \"*.py\" | entr python -m unittest discover\n  ```\n  * https://github.com/clibs/entr\n\n* Coverage report\n  ```bash\n  python -m unittest discover -s tests/\n  coverage run -m unittest discover -s tests/\n  coverage report -m --include=\"*{your_app_name}*\"\n  ```\n\n\n## Resources\n\nLinks to resources (tutorials, books, blog posts, repositories, ...).\n\n### SW Development\n\n* https://github.com/jamiebuilds/the-super-tiny-compiler\n  * Reading through the guided code will help you learn about how most compilers work from end to end\n\n* https://github.com/karan/Projects\n  * A list of practical projects that anyone can solve in any programming language\n\n\n## Ubuntu\n\n### Gnome shortcuts\nhttps://help.gnome.org/users/gnome-help/stable/shell-keyboard-shortcuts.html\n\n| Action                                            | Shortcut                            |\n| :------------------------------------------------ |:----------------------------------- |\n| Switch between workspaces                         | Super + Page Up / Page Down         |\n| Move the current window to a different workspace  | Shift + Super + Page Up / Page Down |\n| Move the current window one monitor to the left   | Shift + Super + ←                   |\n| Move the current window one monitor to the right  | Shift + Super + →                   |\n\n\n### Fresh install\n\n#### Interface\n*\n  ```\n  sudo apt update\n  sudo apt upgrade\n  sudo apt install gnome-tweaks gnome-shell-extensions chrome-gnome-shell\n  sudo apt install gir1.2-gtop-2.0 gir1.2-networkmanager-1.0 gir1.2-clutter-1.0\n  gnome-session-quit\n  ```\n\n* window buttons to left\n\t * gnome-tweaks -\u003e windows -\u003e bottom most \"Placement\" (under \"Titlebar Buttons\")\n\n* don't suspend on lid closed\n\t * gnome-tweaks -\u003e power -\u003e switch off\n\n* minimize on icon click\n\t * gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'\n\n* add keyboard layout\n\t * settings -\u003e Region \u0026 Language\n\n* change keyboard layut switch shortcut to alt + shift\n\t * gnome-tweaks -\u003e keyboard and mouse -\u003e Additional Layout Options -\u003e Switching to another layout\n\n* install gnome shell integration browser extension (to firefox, preferably)\n\t * https://extensions.gnome.org/\n\n* move panel time to right\n\t * https://extensions.gnome.org/extension/2/move-clock/\n\n* system monitor shell extension\n\t * https://extensions.gnome.org/extension/120/system-monitor/\n\n* suspend button shell extension\n\t * https://extensions.gnome.org/extension/826/suspend-button/\n\n* center new window\n\t * `sudo apt install dconf-editor`\n\t * set center-new-windows\" in /org/gnome/mutter/ to \"true\"\n\n\n#### Common\n```\nsudo apt install curl git python3-pip tmux xclip meld\n```\n\n#### virtualenvwrapper\nCredits: https://medium.com/@gitudaniel/installing-virtualenvwrapper-for-python3-ad3dfea7c717\\\n```\npip3 install virtualenvwrapper\n```\n\nAdd to `~/.bashrc`\n```\nexport WORKON_HOME=$HOME/.virtualenvs\nexport VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3\nexport VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv\nsource ~/.local/bin/virtualenvwrapper.sh\n```\nthen run `source ~/.bashrc`\n\n#### Golang\nDownload installer (not source!), e.g. `go1.11.1.linux-amd64.tar.gz` from https://golang.org/dl/\n```\ncd ~/Downloads/\nsudo tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz\n```\n\nAdd to `~/.bashrc`\n```\nexport PATH=$PATH:/usr/local/go/bin\nexport GOPATH=$HOME/code/go\nexport PATH=$PATH:/usr/local/go/bin:$(go env GOPATH)/bin\n```\nthen run `source ~/.bashrc`\n\n##### Delve\n```\ngo get -u github.com/derekparker/delve/cmd/dlv\n```\n\n#### Docker\nhttps://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04\n```\ncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\nsudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge\"\napt-cache policy docker-ce\nsudo apt install -y docker-ce\nsudo usermod -aG docker ${USER}\n```\n\n##### Docker Compose\nhttps://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-22-04\n\n#### Media\n```\nsudo apt install vlc clementine\n```\n\n#### VirtualBox\n```\nsudo apt install virtualbox\nsudo apt install virtualbox-guest-additions-iso\nsudo apt install virtualbox-ext-pack\nsudo adduser $USER vboxusers\n```\n\n#### Laptop specific\n```\nsudo apt install tlp tlp-rdw\n```\n\n\n## PostgreSQL\n* [PostgreSQL when it’s not your job.](https://thebuild.com/presentations/not-your-job-pgconf-us-2017.pdf)\n* [WITH HOLD CURSORS AND TRANSACTIONS IN POSTGRESQL](https://www.cybertec-postgresql.com/en/with-hold-cursors-and-transactions-in-postgresql/)\n\n\n## Rpi\n\n```\nnmap -sL 192.168.1.0/24 | grep pi | grep -oP '(?\u003c=\\().*(?=\\))'\n```\n* [System time problem on Raspberry Pi after power outage](https://raspberrypi.stackexchange.com/questions/74159/system-time-problem-on-raspberry-pi-after-power-outage)\n* [How accurate is Raspberry Pi's timekeeping?](https://raspberrypi.stackexchange.com/questions/1397/how-accurate-is-raspberry-pis-timekeeping)\n* [How do I set Raspbian to use the primary time server time.nist.gov?](https://raspberrypi.stackexchange.com/questions/68811/how-do-i-set-raspbian-to-use-the-primary-time-server-time-nist-gov/68812#68812)\n* [How to force NTPD to update date/time after boot?](https://raspberrypi.stackexchange.com/questions/8231/how-to-force-ntpd-to-update-date-time-after-boot/107344)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdusanmadar%2Ftips-tricks-configs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdusanmadar%2Ftips-tricks-configs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdusanmadar%2Ftips-tricks-configs/lists"}