Basic Linux Commands

There is never a shortage of good cheatsheets specially for Linux

Directory Listing

ls
Gemfile				app				dump.rdb			spec
Gemfile.lock

Directory Listing with hidden files

$ ls -al
total 1376
drwxr-xr-x   49 thorpeobazee  staff    1666 Sep 17 22:33 .
drwxr-xr-x   13 thorpeobazee  staff     442 Sep 17 21:06 ..
-rw-r--r--    1 thorpeobazee  staff     633 Sep  7 08:28 .babelrc
-rw-r--r--    1 thorpeobazee  staff     163 Sep 12 18:19 .eslintrc
drwxr-xr-x   16 thorpeobazee  staff     544 Sep 18 09:44 .git
-rw-r--r--    1 thorpeobazee  staff     736 Sep  7 08:28 .gitignore
drwxr-xr-x    9 thorpeobazee  staff     306 Jun  7 12:05 .idea
-rw-r--r--    1 thorpeobazee  staff      20 Sep  7 08:28 .jshintrc
-rw-r--r--    1 thorpeobazee  staff      30 Jun  5 19:35 .rspec
-rw-r--r--    1 thorpeobazee  staff     898 Jun 16 13:42 .rubocop.yml
-rw-r--r--    1 thorpeobazee  staff      14 Jun  5 19:35 .ruby-gemset
-rw-r--r--    1 thorpeobazee  staff       6 Jun  5 19:35 .ruby-version
drwxr-xr-x    5 thorpeobazee  staff     170 Sep  7 08:28 .storybook
-rw-r--r--    1 thorpeobazee  staff    2515 Sep 12 18:19 Gemfile
-rw-r--r--    1 thorpeobazee  staff   19934 Sep 12 18:19 Gemfile.lock

Change Directory

Changes directory to other_dir

cd other_dir

 How to Backup a Heroku Database

Backup databases are one of the most important things you can do for your applications. It allows you to restore your database in case of problems in updating your database or simply due to some hacking.

Back up a Heroku database

$ heroku pg:backups:capture
Starting backup of postgresql-diagonal-12345... done

Use Ctrl-C at any time to stop monitoring progress; the backup will continue running.
Use heroku pg:backups:info to check progress.
Stop a running backup with heroku pg:backups:cancel.

Backing up EMBER to b001... done

Download a Heroku database dump

heroku pg:backups:download
Getting backup from  your-app... done, #1
Downloading latest.dump.. 100% 00:00 6.84MB

Backup database of a particular app

$ heroku pg:backups capture --app grow360-eu
Starting backup of postgresql-diagonal-12345... done

Use Ctrl-C at any time to stop monitoring progress; the backup will continue running.
Use heroku pg:backups:info to check progress.
Stop a running backup with heroku pg:backups:cancel.

Backing up EMBER to b001... done

To get the link of your dump

This will return the a url for your to download

heroku pg:backups public-url b001 -a your-app
https://feratu.s3.amazonaws.com/76784543jkjskdjfsdjdkljklgjsdlfjgsdfgsdf/gsdfgjsdjgksdfgsd/gsdjfgklsdjgfslkfgjsdg/gsjdfgkjsdlfgjsdfgjsdfgjkAmz=fjaklsfjalksfjklj

Done!

 How to Remove Box Shadow from Elements

A lot of developers and designers work with bootstrap nowadays and sometimes you need to override rules created by default by the framework. Here’s something I needed to remove a while back.

.progress {
    -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
}

Progress bars have a default box-shadow. To remove it, simply add a rule to change the value to none

// from bootstrap
.progress {
    -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
}

//custom
.no-shadow {
    -webkit-box-shadow: none;
    box-shadow:none;
}

Apply this to your own elements

<div class="progress no-shadow">
  <div class="progress-bar no-shadow"></div>
</div>

Done!

.

 Heroku: Cannot run more than 1 Free size dynos

 Cannot run more than 1 Free size dynos.

This is a common error when you forget or cancel a connection to heroku when using commands like:

heroku run rake db:migrate
bc(language-bash). heroku run  rails c --app you_app_name

Check your sessions

You will need to check if you have any sessions running with:

$ heroku ps --app your_app_name
=== web (Free): bundle exec puma -C config/puma.rb (1)
web.1: up 2017/06/13 10:23:38 +0800 (~ 33m ago)

=== worker (Free): bundle exec sidekiq -c 5 -q mailers -q default (1)
worker.1: up 2017/06/13 10:23:19 +0800 (~ 33m ago)

=== run: one-off processes (1)
run.2943 (Free): up 2017/06/13 10:39:57 +0800 (~ 17m ago): rails c

Stop the session

We will need to stop the session so that we can create a new session which we can use.

heroku ps:stop run.2943 --app your_app_name

Try to run your session

$ heroku run rails c --app your_app_name
Running rails c on your_app_name... up, run.9284 (Free)
Loading staging environment (Rails 4.2.8)
[1] pry(main)>

Done!