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
@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 .

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 / symfony_permission.md
Last active December 14, 2017 17:36
Another permission command

Symfony

HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1)
setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX app/cache app/logs
find ./ -type d -exec chmod 755 {} \;
find ./ -type f -exec chmod 644 {} \;
@mjavadhpour
mjavadhpour / php-5.6-repository.md
Last active November 13, 2017 14:17
PHP 5.6 install in linux
$ sudo add-apt-repository ppa:ondrej/php
@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

@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)

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 / 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 / Symfony
Created December 14, 2016 07:57
Symfony install server
export SYMFONY_ENV=prod
composer install --no-dev --optimize-autoloader