Skip to content

Instantly share code, notes, and snippets.

View mjavadhpour's full-sized avatar
:octocat:

M.J. mjavadhpour

:octocat:
  • The Earth
View GitHub Profile

I seem to have resolved this by putting

deb http://cz.archive.ubuntu.com/ubuntu trusty main

in

/etc/apt/sources.list 

(as mentioned on the Ubuntu site at libsystemd-journal0), then doing apt-get update, apt-get install libsystemd-journal0 and apt-get install docker-engine.

@mjavadhpour
mjavadhpour / postman-deb.sh
Created October 29, 2017 06:10 — forked from SanderTheDragon/postman-deb.sh
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
versionMaj="1"
versionMin="0"
versionRev="1"
version="$versionMaj.$versionMin-$versionRev"
echo "Removing old Postman tarballs"
rm -f $(ls Postman*.tar.gz)
@mjavadhpour
mjavadhpour / git-useful-commands.md
Last active October 21, 2017 20:48
Git usefull command

Delete all git branch with pattern:

$ git branch | grep " pattern " | xargs git branch -D

Remove file from git cache:

$ git rm --cached mylogfile.log
$ For a directory:
$ git rm --cached -r mydirectory
@mjavadhpour
mjavadhpour / count-lines-of-code-in-directory.md
Last active May 5, 2018 03:48
How to count all the lines of code in a directory recursively?
$ find . -name '*.php' | xargs wc -l
$ find . -name '*.js' -or -name '*.php' | xargs wc -l | grep 'total'  | awk '{ SUM += $1; print $1} END { print "Total text lines in PHP and JS",SUM }'
$ cloc --exclude-lang=DTD,Lua,make,Python .

PhpStorm should use the same permissions as the user that runs/ launches the script (yourself). Add yourself to the www-data group, or set up a new group.

Let's say you created a new group called "www-pub" and added yourself to it as per instructions.

Remember to log out and back in to have the new group membership take effect. Test your group membership with the groups command.

Then, change permissions of the /var/www directory as follows:

$ chown -R :www-pub /var/www
@mjavadhpour
mjavadhpour / install-nodejs.md
Last active November 6, 2017 13:52
Install order of nodjs new versions

Introduction

Node.js is a JavaScript platform for general-purpose programming that allows users to build network applications quickly. By leveraging JavaScript on both the front-end and the back-end, development can be more consistent and be designed within the same system.

In this guide, we'll show you how to get started with Node.js on an Ubuntu 16.04 server.

If you are looking to set up a production Node.js environment, check out this link: How To Set Up a Node.js Application for Production.

Prerequisites

The Apache web server is the most popular way of serving web content on the internet. It accounts for more than half of all active websites on the internet and is extremely powerful and flexible.
Apache breaks its functionality and components into individual units that can be customized and configured independently. The basic unit that describes an individual site or domain is called a virtual host.
These designations allow the administrator to use one server to host multiple domains or sites off of a single interface or IP by using a matching mechanism. This is relevant to anyone looking to host more than one site off of a single VPS.
Each domain that is configured will direct the visitor to a specific directory holding that site's information, never indicating that the same server is also responsible for other sites. This scheme is expandable without any software limit as long as your server can handle the load.
In this guide, we will walk you through how to set up Apache virtual hosts on an Ubuntu 14.
You should never have to run a website out of your home directory. EVER. You would otherwise have to give the web server the ability to traverse through /home/ to see the directory structure, but also into /home/$USER/ (your user's home directory, where we can try and see what else exists in your user directory), as well as any other subfolders in there. A poorly-configured or misconfigured or unpatched web server can cause massive data leakage this way, or loss of credentials and such which would put your personal data and logins on different things at risk. The symlink approach you are using doesn't help either for the same reason as trying to give Apache permissions to read /home/andre/www/moodle - the web server has to be able to traverse your home directory to get to the location that the symlink in /var/www/html points to, which still poses that security risk.
Firstly, use sudo cp -r /home/andre/www/moodle/ /var/www/html/. This will copy your files to /var/www/html, and keep it away from your own home
Today I got again problem with PHP 7 running despite I have disabled php7.0 apache module: phpinfo was showing php 7 using fastCGI ...
... So if after you follow the below instructions you face this situation, you may need to disable the proxy_fcgi apache module:
sudo a2dismod proxy_fcgi proxy; sudo service apache2 restart
1. Re-Install PHP 5.6
What worked for me was this guide: http://www.lornajane.net/posts/2016/php-7-0-and-5-6-on-ubuntu
Actually is not required to remove php7.0, you can install php5.6 together ( also because you will have dependency problem with phpmyadmin package that required php7.0)