Installing mutt on Arch


Install mutt by using the following command:

sudo pacman -S mutt

Now create the base directories and a file using:

mkdir -p ~/.mutt/cache/{bodies,headers}
touch ~/.mutt/certificates

Use the following muttrc file, especially for Gmail:

Modify it to according to your credentials and place it in the home folder (~/).

Now you can execute mutt simply using:

mutt

For those who have enabled two-step verification in Gmail, directly entered password or written in muttrc will not work. You have to create an App password (https://security.google.com/settings/security/apppasswords) and enter the given password in your muttrc. Then it will work.

Although, it is not recommended to write your passwords in muttrc. You should set up gpg keys. For this refer to: https://wiki.archlinux.org/index.php/Mutt

References:

https://wiki.archlinux.org/index.php/Mutt

http://www.vigasdeep.com/mutt-the-ultimate-mailing-client/

Installing LAMP on ArchBang


First of all update and upgrade your system:

sudo pacman -Syu

APACHE

Install apache

sudo pacman -Syu apache

 

Configuring Apache:

Note: Always create a backup file before editing files critical files. You can copy the particular file before editing (use cp command).

 

Edit /etc/httpd/conf/extra/httpd-mpm.conf to have this:

<IfModule mpm_prefork_module>
StartServers        2
MinSpareServers     6
MaxSpareServers     12
MaxRequestWorkers   30
MaxRequestsPerChild 3000
</IfModule>

 

Edit /etc/httpd/conf/extra/httpd-default.conf:

KeepAlive Off

 

To make Apache auto-start at boot:

sudo systemctl enable httpd.service

 

Now type localhost in your browser. This should show Index / in browser because no file is currently there.

 

Now configuring virtual hosts.

Edit file: /etc/httpd/conf/httpd.conf and edit the line containing DocumentRoot and set it to:

DocumentRoot "/srv/http/default"

 

Now go to almost bottom of the file i.e. near line 500 (or 92% of file) and Uncomment the line:

Include conf/extra/httpd-vhosts.conf

 

Now open /etc/httpd/conf/extra/httpd-vhosts.conf and paste the following:

<VirtualHost *:80> 
     ServerAdmin root@localhost
     ServerName localhost
     ServerAlias localhost
     DocumentRoot /srv/http/localhost/public_html/
     ErrorLog /srv/http/localhost/logs/error.log 
     CustomLog /srv/http/localhost/logs/access.log combined
            <Directory />
               Order deny,allow
               Allow from all
            </Directory>
</VirtualHost>

You can replace localhost with your domain name.

 

Now create the directories according to the configuration done above:

sudo mkdir -p /srv/http/default
sudo mkdir -p /srv/http/localhost/public_html
sudo mkdir -p /srv/http/localhost/logs

 

Now restart Apache:

sudo systemctl restart httpd.service

It will still show you an Index / page when you type in ‘localhost’ in the browser. If you want a custom web page to appear while doing the same, then go and createa new file:

/srv/http/localhost/public_html/index.html 

And add some text that you want it to show. That’s it.

 

MySQL

In Arch, MariaDB can be used alternatively of MySQL.

So, installing the mariadb, mariadb-clients and libmariadbclient packages using the following command:

sudo pacman -Syu mariadb mariadb-clients libmariadbclient

Install MariaDB data directory:

sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

All mysql command will work as usual with MariaDB.

Now to make it start on boot:

sudo systemctl start mysqld.service 
sudo systemctl enable mysqld.service  

At last, to have secure installation, run:

mysql_secure_installation

And set root password (Press Enter for current password) and then enter new password for root. Remove remote login, anonymous users, test database and reload privileges tables.

You can now test the installation by firing this command:

mysql -u root -p

It will prompt for your password that you have just set.
Then you can try creating database, tables as usual.

 

PHP

sudo pacman -Syu php php-apache

 

Edit /etc/php/php.ini and search for following lines and uncomment and modify them:

error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
log_errors = On 
error_log = /var/log/php/error.log
max_input_time = 30
extension=mysql.so

 

Create the log directory for PHP and give the Apache user ownership:

sudo mkdir /var/log/php
sudo chown http /var/log/php

Enable the PHP module in the /etc/httpd/conf/httpd.conf by adding these lines at the end:

#Dynamic Shared Object (DSO) Support
LoadModule php5_module modules/libphp5.so
# Supplemental configuration
# PHP 5
Include conf/extra/php5_module.conf

# Located in the <IfModule mime_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

In the same file, comment out the line LoadModule mpm_event_module modules/mod_mpm_event.so by adding a # in front, and add the line:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

And add the following line:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Restart Apache server:

sudo systemctl restart httpd.service

 

phpMyAdmin

Install phpMyAdmin using the following command:

sudo pacman -S phpmyadmin

Enable the mysqli and mcrypt by editing /etc/php/php.ini and uncommenting the following lines:

extension=mysqli.so
extension=mcrypt.so

You need to make sure that PHP can access /etc/webapps. Add it to open_basedir in /etc/php/php.ini if necessary:

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/

Edit /etc/httpd/conf/extra/phpmyadmin.conf file:

Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted
</Directory>

 

Edit /etc/httpd/conf/httpd.conf:

# phpMyAdmin configuration
Include conf/extra/phpmyadmin.conf

 

Restart Apache again:

sudo systemctl restart httpd.service

 

Now click on http://localhost/phpmyadmin/ and see phpMyAdmin opening in the new tab.

 

Sources:

https://www.linode.com/docs/websites/lamp/lamp-server-on-arch-linux

https://wiki.archlinux.org/index.php/PhpMyAdmin

Some unknown git commands


To loose the unstaged changes to a file (i.e. reverting to the committed changes) while using git:

git checkout <file-name>

It will not loose another unstaged or staged changes.

To show a log of commits:

git log

To show detailed log:

git log -p

To see the detailed log about a particular file:

git log -p coord.csv

 

To see a file at a specific commit, we have to first check the commit-id or hash using the git log commands explained above. You may copy a first few characters of a commit-id. The syntax for this is:

git show commit-id:filename

For instance,

git show f1a95c65900f5:coord.csv

This will show the file at that specific commit. You can also direct its output to a new file using the ‘>’ operator.

And to show all changes at that particular commit:

git show f1a95c65900f5

So to revert to all changes at a commit state:

git revert f1a95c65900f5

To revert one file to a particular commit:

git checkout <hash> <file path>

Creating figures in dxfwrite


The task is to create a Drain drawing and then calculate the area of cutting and filling.

Firstly, I tried to create lines using coordinates.

See this for the code:
https://github.com/mandeeps708/PyDrain

Next, I’ll try it by getting input from a CSV file.

Follow the official documentation here: http://dxfwrite.readthedocs.org/en/latest/index.html