Skip to content

Instantly share code, notes, and snippets.

View harendra21's full-sized avatar
🏠
Working from home

Harendra Kumar Kanojiya harendra21

🏠
Working from home
View GitHub Profile
<?php
namespace App;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
require './../vendor/autoload.php';
use Medoo\Medoo;
class Chat implements MessageComponentInterface
{
protected $clients;
private $activeUsers;
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text

How to install Sublime Text 4 in Ubuntu - Easy Way

click here to read full

Automatic

wget https://gist.githubusercontent.com/harendra21/b05687b047d6ab61ed1e195deee863c9/raw/cf6d933ca1a65ba086e7446ca7cd0e9362f15666/sublime.sh && sh ./sublime.sh

Mannual

wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -

sudo apt-get install apt-transport-https

sudo apt update && sudo apt install -y mongodb

// check status

sudo systemctl status mongodb

//start service

sudo systemctl start mongod

sudo apt install mysql-server

sudo mysql_secure_installation

Python 3 speech recognition (speech to text)

For speech recognition we need to install SpeechRecognition package via PIP

pip install SpeechRecognition

After installing the package we need to copy and paste following code an run our program

import speech_recognition as sr
sudo apt update -y
sudo apt install apache2 -y
sudo apt install php7.4 php7.4-mysql php-common php7.4-cli php7.4-json php7.4-common php7.4-opcache libapache2-mod-php7.4 -y
sudo systemctl restart apache2
sudo apt install mariadb-server mariadb-client -y
sudo mysql_secure_installation
def binary_search(item_list,item):
first = 0
last = len(item_list)-1
found = False
while( first<=last and not found):
mid = (first + last)/2
if item_list[mid] == item :
found = True
else:
if item < item_list[mid]:
def binary_search_recursive(list_of_numbers, number, start=0, end=None):
# The end of our search is initialized to None. First we set the end to the length of the sequence.
if end is None:
end = len(list_of_numbers) - 1
if start > end:
# This will happen if the list is empty of the number is not found in the list.
raise ValueError('Number not in list')