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
# Call scopes directly from your URL params: | |
# | |
# @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Call the class methods with names based on the keys in <tt>filtering_params</tt> | |
# with their associated values. For example, "{ status: 'delayed' }" would call |
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
# spin up our new (empty) database | |
docker compose up -d db_postgres_151 | |
# login to postgres | |
$ psql -U postgres | |
$ CREATE DATABASE database_name | |
# dump our existing database | |
docker compose exec -it db_postgres_146 /bin/bash -c 'pg_dumpall -U $POSTGRES_USER > /backup/20230127.sql' |
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
# Check server process is using jemalloc | |
# ref. [Japanese] https://tech.studyplus.co.jp/entry/2019/09/09/094140 | |
class AppController < ActionController::Base | |
def show | |
r = `strings /proc/#{Process.pid}/maps | grep jemalloc` | |
render plain: "<h1>#{ENV['LD_PRELOAD'].presence || 'empty'}</h1><pre>#{r}</pre>" | |
end | |
end |
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
# Refresh ubuntu keys server | |
$ sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com | |
# Group permission change | |
$ sudo chgrp -R root esdata | |
# Add current login User ID to .bashrc or .zshrc file | |
$ echo "export UID=$UID" >> ~/.bashrc | |
or | |
$ echo "export UID=$UID" >> ~/.zshrc |
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
If you want to run docker as non-root user then you need to add it to the docker group. | |
1. Create the docker group if it does not exist | |
$ sudo groupadd docker | |
2. Add your user to the docker group. | |
$ sudo usermod -aG docker $USER | |
3. Run the following command or Logout and login again and run (that doesn't work you may need to reboot your machine first) | |
$ newgrp docker | |
4. Check if docker can be run without root | |
$ docker run hello-world | |
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
## Awesome Guidelines | |
https://github.com/Kristories/awesome-guidelines | |
## List of Free Learning Resources | |
https://github.com/EbookFoundation/free-programming-books | |
## Angular 2+ Components & Libraries | |
https://github.com/brillout/awesome-angular-components | |
## বাংলায় শেল ও শেলস্ক্রিপ্টিং শেখার কোর্স https://sh.howtocode.com.bd |
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
MiniKube Setup: | |
1. https://kubernetes.io/docs/tasks/tools/install-minikube/ | |
2. https://kubernetes.io/docs/tasks/tools/install-kubectl/ | |
KOPS Setup for production: | |
http://github.com/kubernetes/kops |
- Transparent The consequences of change should be obvious in the code that is changing and in distant code that relies upon it
- Reasonable The cost of any change should be proportional to the benefits the change achieves
- Usable Existing code should be usable in new and unexpected contexts
- Exemplary The code itself should encourage those who change it to perpetuate these qualities
Code that is Transparent, Reasonable, Usable, and Exemplary (TRUE) not only meets today’s needs but can also be changed to meet the needs of the future. The first step in creating code that is TRUE is to ensure that each class has a single, well-defined responsibility.
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
## python 3.7 install | |
-> sudo apt update | |
-> sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget | |
-> sudo apt install software-properties-common | |
-> sudo add-apt-repository ppa:deadsnakes/ppa | |
-> sudo apt update | |
-> sudo apt install python3.7 | |
-> python3.7 --version | |
## pip3 install |
NewerOlder