Best php open source projects

1. Laravel

This is the best php-framework for new projects, web-sites, internet stores and other network projects.

The GitHub page of Laravel from where you can download and see the project code is: https://github.com/laravel/laravel

2. Symfony

Another PHP framework for web applications is Symfony. It is used by thousands of web applications (including BlaBlaCar.com and Spotify.com) and most of the popular PHP projects (including Drupal and Magento).GitHub Stars: 17.8k+

The GitHub page of Symfony from where you can download and see the project code is: https://github.com/symfony/symfony

3. Composer

Composer helps you declare, manage, and install dependencies of PHP projects.

GitHub Stars: 14.9k+

The GitHub page of Composer from where you can download and see the project code is: https://github.com/composer/composer

4. PHPMailer

PHPMailer is the best php library for sending email. Supports many mail servers including Gmail.

The GitHub page of PHPMailer from where you can download and see the project code is: https://github.com/PHPMailer/PHPMailer

How to view information about ONU on BDCOM OLT

I’ll give you an example of viewing information about ONT (ONU) on EPON OLT BDCOM P3310C, on other models is essentially the same.

Connect to OLT and go into configuration mode:

enable
config

To view the ONU list, use the commands:

show epon onu-information
show epon active-onu
show epon inactive-onu

Example of viewing MAC addresses on a port or ONU:

show mac address-table interface EPON0/1
show mac address-table interface EPON0/1:5
show mac address-table brief

Viewing the optical power of all ONUs on the first port and a specific ONU:

show epon optical-transceiver-diagnosis interface EPON 0/1
show epon interface ePON 0/1:4 onu ctc optical-transceiver-diagnosis

View ONU models and firmware versions:

show epon onu-software-version
show epon onu-software-version interface EPON 0/1

View description and status of interfaces:

show interface brief

ONU ethernet port status and viewing statistics:

show epon interface epON 0/1:1 onu port 1 state
show epon interface epON 0/1:1 onu port 1 statistics
show epon interface epON 0/1:1 onu mac address-table

Also you can see in the saved and active OLT configuration which ONUs are registered:

show configuration
show running-config

ONU reboot example:

epon reboot onu interface ePON 0/1:1

How to change MAC address on Mikrotik Routerboard

By default changing MAC address of ethernet interface in Mikrotik Winbox is disabled:

But You can very simple change MAC in terminal.
In left side menu select New Terminal:

Then enter command:

/interface ethernet set ether1 mac-address=XX:XX:XX:XX:XX:XX

Where ether1 is required interface and XX:XX:XX:XX:XX:XX is new MAC address of your device.

Thats all.

Create Shortcut for Windows program in Ubuntu

  1. Download png icon of your program from Internet.
  2. Create file name.desktop and insert next code:
[Desktop Entry]
Name=ProgramName
Exec=wine "/home/user/Programs/ProgramName/ProgramName.exe"
Icon=/home/user/Programs/ProgramName/ProgramName.png
Type=Application
Categories=Wine;
Name[en_US]=ProgramName

Change text “ProgramName” to name of your program.

Finally change permission for execution this file. That’s all. See the video:

Create React js application with Yarn

Very simple way to create new application on React JS using Yarn.

First of all install LTS version of Node.js on your computer from official site: https://nodejs.org/en/download/

Then also install stable version of Yarn from official site: https://yarnpkg.com/en/docs/install. (You can read here how to install Yarn in Ubuntu).

Next lets create new folder “react-app” with files of our application. In this folder create two empty files: index.html, package.json, and subfolder src such as on screenshot:

File index.html will have basic html markup:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>React App</title>
</head>
<body>
    <noscript>
        You need to enable JavaScript to run this app.
    </noscript>

    <div id="root"></div>

    <!-- Bundle -->
    <script src="./src/index.js"></script>
</body>
</html>

In subfolder src create file index.js, it will be main file of our react application:

Source code of index.js file:

import React from 'react';
import ReactDOM from 'react-dom';

const App = () => (
    <div>
        React App
    </div>
);
ReactDOM.render(<App />, document.getElementById('root'))

In file package.json write next code:

{
    "name": "ReactApp",
    "author": "Author Name",
    "license": "License Name",
    "homepage": "Author Website",
    "email": "Author Email",
    "version": "1.0.0",
    "scripts": {
      "start": "cross-env NODE_ENV=development parcel index.html --no-cache -d build/dev",
      "build": "cross-env NODE_ENV=production parcel build index.html --no-cache -d build/production"
    },
    "dependencies": {
      "@hot-loader/react-dom": "^16.8.4",
      "cross-env": "^5.2.0",
      "parcel-bundler": "latest",
      "react": "^16.8.4",
      "react-dom": "^16.8.4"
    },
    "devDependencies": {
      "babel-core": "^6.26.3",
      "babel-plugin-import": "^1.11.0",
      "babel-preset-react-app": "^7.0.1"
    }
  }

This file contains information about your project and all outsiders packages, used in your application.

That’s all, our simple react application ready. Now lets run it. Open your command line and go to your project folder:

To compose your application write command:

yarn

Yarn will download all packages and compose your application:

To run your program just enter command:

yarn start

This command builds your react application and start local server http://localhost:1234

Enter on this address in your browser and you will see your application:

Now if you change any source code in your project, it will be automatic changed in browser:

That’s all, finally look in folder build. There You will find compiled JavaScript code with your application which you can use in production.

React it’s simple! Good luck 😉

Reinstall youtube-dl on Ubuntu 18.04

First remove old version of youtube-dl if installed:

sudo apt-get remove youtube-dl

Next install latest version of youtube-dl and install it:

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

If you have an error such “/usr/bin/env ‘python’ no such file or directory youtube-dl” – thats meen than you does not have installed python, or you install python3. Install python by command:

sudo apt install python-minimal

Or you can start youtube-dl with python3:

python3 /usr/local/bin/youtube-dl

Or you can create symbolic link python3->python with following command:

sudo ln -s /usr/bin/python3 /usr/local/bin/python

Налаштування BDCOM P3310

bdcom p3310

Підключіть кабель в COM порт комп’ютера та Console порт на оптичному терміналі. Вікрийте програму Putty та підключіться до COM порта на швидкості 9600

Для входу в консоль введіть логін: admin, пароль: admin

Після підключення перейдемо в рожим налаштування, для йього введіть по черзі наступні команди:

enable
config

Щоб переглянути поточну збережену і активну конфігурацію введіть команди:

show configuration
show running-config

Приступаємо до налаштування!
1) Вилучимо стандартний vlan 1 і додамо vlan управління (у мене він 1000), vlan 1001 (клієнтський):

ІР адреса оптичного терміналу: 10.10.0.3
Шлюз по замовчуванню 10.10.0.1 (у вас ці настройки можуть бути іншими)

no interface vlan 1
vlan 1000,1001
exit
interface vlan 1000
description core
ip address 10.10.0.3 255.255.255.0
exit
ip default-gateway 10.10.0.1

П’ятий комбо порт я налаштував як вхідний (1000 – vlan управління, 1001 – клієнтський):

interface gigaEthernet 0/5
description UPLINK
no shutdown
switchport trunk vlan-allowed 1000
switchport trunk vlan-allowed add 1001
switchport trunk vlan-untagged none
switchport mode trunk
exit

Вибрав комбо порт щоб можна було включити вхідний лінк по міді або SFP.

3) Напишемо шаблон для онушок (надалі вони самі будуть реєструватися, потрібно буде тільки дописувати опис і зберігати конфиг):

epon onu-config-template user1
cmd-sequence 001 epon onu port 1 ctc vlan mode tag 1001
cmd-sequence 002 epon onu port 1 ctc loopback detect
cmd-sequence 003 epon onu port 2 ctc vlan mode tag 1001
cmd-sequence 004 epon onu port 2 ctc loopback detect
cmd-sequence 005 epon onu port 3 ctc vlan mode tag 1001
cmd-sequence 006 epon onu port 3 ctc loopback detect
cmd-sequence 007 epon onu port 4 ctc vlan mode tag 1001
cmd-sequence 008 epon onu port 4 ctc loopback detect
cmd-sequence 009 loopback-detection recovery-time 7200
exit

Налаштуємо EPON порти:

interface EPON0/1
no shutdown
description ixnfo
switchport trunk vlan-untagged none
switchport trunk vlan-allowed 1001
switchport mode trunk
epon pre-config-template user1 binded-onu-llid 1-64
filter dhcp
switchport protected 1
  
interface EPON0/2
no shutdown
description ixnfo
switchport trunk vlan-untagged none
switchport trunk vlan-allowed 1001
switchport mode trunk
epon pre-config-template user1 binded-onu-llid 1-64
filter dhcp
switchport protected 2
  
interface EPON0/3
no shutdown
description ixnfo
switchport trunk vlan-untagged none
switchport trunk vlan-allowed 1001
switchport mode trunk
epon pre-config-template user1 binded-onu-llid 1-64
filter dhcp
switchport protected 3
  
interface EPON0/4
no shutdown
description ixnfo
switchport trunk vlan-untagged none
switchport trunk vlan-allowed 1001
switchport mode trunk
epon pre-config-template user1 binded-onu-llid 1-64
filter dhcp
switchport protected 4

Добавимо адміністратора і пароль (замість слова TEXT введіть ваш пароль):

aaa authentication login default local
aaa authentication enable default none
aaa authorization exec default local
username admin password 0 TEXT
enable password 0 TEXT
service password-encryption

Вкажемо з яких адрес дозволено підключатися адміну:

ip access-list standard MANAGEMENT
permit 10.10.0.1 255.255.255.255
exit
ip telnet access-class MANAGEMENT

Вкажемо часовий пояс і NTP-сервер з яким синхронізувати час (на нових прошивках замість sntp потрібно писати ntp):

time-zone Kyiv +2
sntp server 10.10.0.1
sntp query-interval 3600

Налаштуємо SNMP для збору статистики:

snmp-server location test
snmp-server contact test
snmp-server community public ro MANAGEMENT

Налаштуємо ім’я пристрою (замість тексту olt_3 введіть назву вашого пристрою) і довжину консольного рядка:

hostname olt_3
terminal width 256
terminal length 256

Відключимо HTTP (за бажанням)

no ip http server

Або налаштуємо з доступом по IP з раніше створеного access-list

ip http server
ip http access-class MANAGEMENT

Вкажемо період в секундах через який повинен включаться порт після стану error-disable:

error-disable-recovery 10800

Зберігаємо налаштування:

write

На нових прошивках зберігаємо так:

write all

На цьому основна настройка завершена.

Додаткові налаштування

Виберемо потрібну ONU і додамо опис:

interface EPON0/1:1
description TEXT

За бажанням замість telnet можна використовувати SSH, який включається командою:

ip sshd enable

Якщо яка-небудь ONU флудить, наприклад EPON0/2:28, то можна відключити на ній ethernet порт (при петлі це не допоможе):

interface EPON0/2:28
epon onu port 1 ctc shutdown

При петлі можна додати ONU в чорний список і видалити з порта, після цього ONU не зможе автоматично зареєструватися, а в лог файлі будуть записи «reject»:

interface EPON0/2
epon onu-blacklist mac e067.b37d.d3d3
no epon bind-onu mac e067.b37d.d3d3

Дозволити на ONU тільки два MAC адреси можна так:

interface EPON0/2:2
switchport port-security dynamic maximum 2
switchport port-security mode dynamic

Перегляд версії прошивки, MTU, списку адміністраторів:

show version
show system mtu
show local-users

Скидання на заводські налаштування:

delete startup-config
reboot

How to reboot Mikrotik if ping failed

Let’s write script that reboot mikrotik device if no ping to gateway.

First of all lets go to menu System -> Script in Winbox and create new script with name PingCheck

Write this core in field Source:

:if ([/ping 10.21.2.1 count=10] = 0) do={
     /system reboot
}

Don’t forget to change IP 10.21.2.1 to yours gateway IP address.

Now lets create scheduler that will start this script every 10 minutes. Go to menu System -> Scheduler and create new task:

Write some name of new task, set start date Jan/01/1970, time 00:00:00 and run interval 00:10:00. Don’t forget to write script name PingCheck in field On Event.

That’s all.