Skip to content

Instantly share code, notes, and snippets.

View 1UC1F3R616's full-sized avatar
:shipit:
Attention is All You Need

Kush Choudhary 1UC1F3R616

:shipit:
Attention is All You Need
View GitHub Profile

To stop CORS

socketio = SocketIO(app, cors_allowed_origins='*')

sending json from client to server on a particular namespace

@socketio.on('attendence_request', namespace='/attendence_namespace')
def take_attendence_from_user(json):
    print('\n\n\n\n\nUSER MESSAGE: {}'.format(str(json)))

Read Write and Destory

import cv2
import numpy as np

def debug(x):
    print('\n\n{}\n\n'.format(str(x)))

image = 'images/image2.jpg'

CRUD

# pip install python-firebase

from firebase import firebase

firebase = firebase.FirebaseApplication("https://hale-ivy-111111s.firebaseio.com/", None)

data = {
    'Name':'Kush',

Installing Docker-CE in Kali Linux

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
echo 'deb [arch=amd64] https://download.docker.com/linux/debian buster stable' | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install docker-ce

Check it's installed properly

# Expected behaviour: It's shows a message which includes success

To get Time

MOV DL,':'    ; To Print : in DOS
MOV AH,02H
INT 21H

;Seconds Part
Seconds:
MOV AH,2CH    ; To get System Time
INT 21H

finding all available methods

import requests
HEADER = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'}
r = requests.get('https://xkcd.com/353/') # headers = HEADER
print(help(r)) # *r* gives response

Content of the response

  • A neural network is basically a set of functions which can learn patterns
  • TensorFlow allows developers to create dataflow graphs—structures that describe how data moves through a graph, or a series of processing nodes. Each node in the graph represents a mathematical operation, and each connection or edge between nodes is a multidimensional data array, or tensor.

NLP

Tokeniz

from tensorflow.keras.preprocessing.text import Tokenizer
sentences = [
  'i love my dog',
  'I, love my cat'
  • Linear vs Non-Linear Classifier
  • White vs Black box
  • Perceptron, it's types and failure
    • MCNeuron has no concepts of weight so it gives equal weight to all nodes. It has no bias layers, only input and output and step function
  • Artificial Neural Network
    • Dense
    • Partial
    • Number of layers has no rule
    • By default Gradient Decent is used for error correction
  • Nothing but Matrix Algebra and a sequence of Matrix Operations

Flask-App (App with Backend written in PostgreSQL (orm-Flask-Sqlalchemy) | API | Sockets)

OS: Linux | Note: Details are not missing but it's that they are in my mind

  • Make sure You have cors code inside your Flask API's
  • Get a Heroku account and install the heroku cli.
  • Push code to a GitHub repo
  • requirements.txt and Procfile are must
pip freeze > requirements.txt
  • Procfile