Blogs

View as a Table

Adding Additional Nameservers to resolv.conf on Linux


Resolv.conf

If you need to add additional nameservers to your resolv.conf because of DNS related issues, you'll want to use a package that manages the file at /etc/resolv.conf. This is because on system restart, the file will be overwritten by other processes and you will lose any previous changes.

Install and Enable Resolvconf Package

sudo apt update
sudo apt install resolvconf

Check if it is running

sudo systemctl status resolvconf
```...

Read Blog Post


Intercepting Action Mailer Emails in Rails


Create an Interceptor Module

To intercept emails in specific environments such as development, testing, or staging, we need to write some logic to do so.

module MailInterceptor
  def self.delivering_email(message)
    # This will be the email that live emails will be sent to 
    message.to = ['your-email@mail.com']

    # Set the cc and bcc to be nil to avoid sending out real emails
    message.cc = nil
    message.bcc = nil

    # Change the from if you want a di...

Read Blog Post


Rotating Logs on Ubuntu


Rotating Logs

If your logs ever start becoming too large to manage, a good way to rotate them is by using logrotate on Ubuntu.

Install logrotate:

sudo apt install logrotate

Then create a file named after what your project is:

sudo vim /etc/logrotate.d/portfolio

You can rotate logs based off of file size or time intervals.

/path/to/logs/www/portfolio/shared/log/*.log {
  size=200M
  missingok
  rotate 12
  compress
  delay...

Read Blog Post


Compressing Files


Tar

-c     Create a new archive containing the specified items.
-r     Like -c, but new entries are appended to the archive.  Note that this only works on uncompressed archives stored in regular files.  The -f option is required.
-t     List archive contents to stdout.
-u     Like -r, but new entries are added only if they have a modification date newer than the corresponding entry in the archive.  Note that this only works on uncompressed archives stored in regular files....

Read Blog Post


Ubuntu 18.04 Nginx, Passenger, Puma, Rails


Install RVM

We should install a version manager to keep our ruby versions and gems.

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.5.1
rvm use 2.5.1 --default
ruby -v

Swap File

You should create a swap f...


Read Blog Post


Setting Up Orange Pi PC Plus


Create Bootable Micro SD

On a windows computer download Win32 Disk Imager and SD Card Formatter. First format the card with the quick format option, then use the imager to install a Debian image from here.

Install Image

Turn off the Orange Pi and then insert the Micro SD Card. Boot it up and it should boot to that card. Try username as root and password 1234. Once loaded, type

sudo nand-sata-install

to install...


Read Blog Post


Reduce PDF Size with Mac Preview


I found myself in a bind with a PDF document that was 112 MB in size when I photo copied all my housing papers into PDF files and combined them into one pdf.

cd folder
convert *.JPG papers.pdf

The file was impossible to email or even display in Google Drive due to its sheer size. I have found a work around to make it happen. Open the PDF you want to downsize in the Preview Mac OS X application.

You'll notice that when you go to the file -> export option, you only hav...


Read Blog Post


AWS CLI (S3, EC2, Route 53)


After uploading a bunch of user content to your AWS S3 Bucket, what do you do if you want to download all that information to back it up?

Luckily AWS has a CLI that we can use.

MacOS X

Follow the steps below to install the CLI using curl. Amazon's steps are found here.

curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundl...

Read Blog Post


Install SSH Ubuntu


Sometimes the Open SSH Server does not come enabled or installed by default on a clean installation. This short guide will show you how to get it one your machine.

Retrieve Openssh-server

Let's download the program.

sudo apt-get install openssh-server

Check Status

Verify that it installed properly.

sudo service ssh status

SSHD Config

If you want to modify any of the ports or settings in SSH, simply open the file and change what...


Read Blog Post


Installing Pi Hole Ubuntu 16.04


Pi Hole is an ad blocking service that uses your server as a DNS to filter out known ad sites and can even filter out pornographic and malicious sites.

Update System

Let's update and upgrade our packages.

sudo apt-get update && sudo apt-get upgrade -y

Install Git

We will need to install git in order to download the Pi Hole repository.

sudo apt-get install git

Establish an Internal Static IP

Because your internal IP address can ...


Read Blog Post