Skip to content

Instantly share code, notes, and snippets.

@mshRoR
mshRoR / important-git-repo-link.txt
Last active January 18, 2020 07:54
important-git-repo-link
@mshRoR
mshRoR / ubuntu-command.txt
Last active April 27, 2020 11:08
Important ubuntu comamnds
# 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
@mshRoR
mshRoR / django2.1-python3.7-pipenv-installing-command.txt
Last active May 13, 2020 07:38
python 3.7 | pip3 | pipenv | django 2.1 installing commands in ubuntu 16.04
## 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
@mshRoR
mshRoR / docker-permission.txt
Created April 8, 2020 08:04
How to fix docker: Got permission denied issue
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
# 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
@mshRoR
mshRoR / upgrade-postgresql-with-docker-compose.txt
Last active January 2, 2024 07:39
upgrade-postgresql-with-docker-compose
# 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'
@mshRoR
mshRoR / filterable.rb
Created January 11, 2024 07:28 — forked from justinweiss/filterable.rb
Filterable
# 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