Learning to Sync Two Directories With rsync On Command Line

On macOs-machines (and other unix-like systems most likely too) you can use rsync command to sync two directories in many different ways.

This post is just a quick reminder two myself for a specific use. See links below for further info!

Imagine you’ve copied some file structure to a new directory, have by accident lost some of the files during that process and further more started to working on the files in the new file structure.

You might have some issues if you want to copy the missing files from the old file structure to the new one without searching too long AND without erasing your new work in the new structure if you’d just repeated the copy process.

I used rsync as follows:

rsync -rP /my/old/directory/ /my/new/directory

-r Option: Recursive, traverse into subdirectories
-P Option: Equivalent to –partial –progress: Show progress during transfer
Note that you need to put a slash after your old directory. If not rsync will simply copy your old directory in the new one instead of searching through your old subdirectories for changes.

Ressources I’ve been using to learn this

https://ss64.com/osx/rsync.html

https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps

http://lucasb.eyer.be/snips/rsync-skipping-directory.html

Learning to Clone A Raspberry Pi’s SD Card (on command line of course)

I wanted to be able to clone a Raspberry Pi’s SD card to having some state that I could go back to if I had messed up to much in this Raspberry Pi’s OS.

As I’m into learning as much command line stuff as possible this is an command line only approach using a Mac (MacOS 10.14.4). Continue reading Learning to Clone A Raspberry Pi’s SD Card (on command line of course)

Learning how to manually backup a self hosted WordPress installation

Backup Database (no plugins required)

  1. Lock into WP backend with admin rights
  2. Chose: Tools/Backup
  3. Tick all boxes to backup all tables
  4. Download and safe file

Drink coffee…

Backup Files (via sftp)

  1. Open sftp client (cyberduck e.g.) locally and log in to webspace
  2. Download and safe all files

Drink more coffee…

 

 

Learning to set up a Development Environment for web Application Projects on OSX

Install Local Server Environment :

To keep it simple, I use MAMP, a one-click-solution to set up my personal developing environment.

I  download the current version from https://www.mamp.info/en/ including the php-version, if other needed then included in the MAMP app. For creating one single development environment the free version is great. For multiple projects the PRO version is reasonable.

I run the installer of MAMP.pkg

Systemwide PHP Version

To make sure I also operate on the same php version like MAMP when running commands from the terminal I update OS X’x PHP version to MAMP’s Version like this:

nano ~/.profile

add to .profile:

export PATH="/Applications/MAMP/bin/php/phpVERSION-#-HERE/bin:$PATH"
export PATH="/Applications/MAMP/bin/php/php5.6.25/bin:$PATH"

Run source command to make this changed active:

source ~/.profile

Check if it’s working with:

php -v

Enable MySQL Commands to run From Terminal

To enable MySQL commands to be run without entering the whole path each time when using on the command line I add as above for the PHP-Version to .profile:

nano ~/.profile

I add to .profile:

export PATH="/Applications/MAMP/Library/bin:$PATH"

I ru the source command to make this changed active:

source ~/.profile

And I check if it’s really working by typing in a MySQL command such as:

MySQL --version

Subversion to Check out Code From Repositories

Subversion is already a part of OS X. Maybe not the newest version, but usable.
So no further steps to be taken.

Check out the Code:

To check out the code I will be working with I use svn checkout command in the directory to which I want the code to be downloaded to:

svn co https://path-to-the-repository/trunk trunk

svn: runs the subversion application
co: runs a checkout
https://path-to-the-repository/trunk: is the remote path where subversion will download the code from
trunk: tells subversion to download the code to a to be created folder called “trunk”

Install Composer Dependencies Locally

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

https://getcomposer.org/doc/00-intro.md

The above link tells in detail how to install.

Setup PhpStorm

PhpStorm is an integrated development environment that helps with a lot of little details. It costs quite some, but there is a 30 day free trial that showed my the worth of this purchase.

The link below hold all infos for setting up PhpStorm:

https://confluence.jetbrains.com/display/PhpStorm/Installing+and+Configuring+MAMP+with+PhpStorm+IDE

Setup Xdebug

Xdebug is a PHP extension which provides debugging and profiling capabilities.

https://en.wikipedia.org/wiki/Xdebug

https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm

and with MAMP:

http://stackoverflow.com/questions/11618178/settings-up-xdebug-on-mamp-pro

Ressources I’ve Been Using to Learn This:

https://www.mamp.info/en/

https://www.tutorialspoint.com/svn/index.htm

https://getcomposer.org/doc/00-intro.md

https://confluence.jetbrains.com/display/PhpStorm/Installing+and+Configuring+MAMP+with+PhpStorm+IDE

https://en.wikipedia.org/wiki/Xdebug

https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm

http://stackoverflow.com/questions/11618178/settings-up-xdebug-on-mamp-pro

Learning how to Back up a Raspberry Pi using rsync

As I started to develop on a Raspberry Pi under Raspbian I needed to find a way to back up the system I’m working on.

I will try to set up this using the linux command rsync. Continue reading Learning how to Back up a Raspberry Pi using rsync

Learning to Setup Postfix to Receive Error Messages From the System of a Raspberry Pi

As I wanted to know more about what the system of my Raspberry Pi was trying to tell me I had to set up a Mail Transfer Agent (MTA). I was using a MTA called postfix in its local only mode. Continue reading Learning to Setup Postfix to Receive Error Messages From the System of a Raspberry Pi

Learning why a Shell Script is not run in boot sequence – Troubleshooting in Raspberry Pi Development

What I want to achive

(but did not so far…)

I want a Raspberry Pi to automatically run a slideshow after the boot sequence. Continue reading Learning why a Shell Script is not run in boot sequence – Troubleshooting in Raspberry Pi Development

Learning to Disable Text Terminals From Blanking in Raspbian (Linux)

EDIT:

By now, I cannot confirm that this is really working… Sorry.

When developing on a Raspberry Pi I wanted to get rid of screen blanking when not touching the terminal for some time. To do so I had to change some settings in a config file as follows. Continue reading Learning to Disable Text Terminals From Blanking in Raspbian (Linux)

Learning to Download Flickr Photos Using Python and FlickrAPI

This was a quite tricky thing for me to get it running but here it is – how I download photos of a set (album) on Flickr (both public and private) with a python script to a Raspberry Pi. Continue reading Learning to Download Flickr Photos Using Python and FlickrAPI