Friday, May 22, 2020

Python libs

1.Requests

Requests is a wonderful python library to send HTTP/1.1 requests within a program. It provides a simpler and higher level way of creating requests for internet interactions. Requests is a definite recommended addition to your collection of python libraries. Below is a quick script to scrape HTML using urllib3:
import urllib3
from bs4 import BeautifulSoup

conn = urllib3.PoolManager()

req = conn.request('GET','https://madhatlabs.com')
soup_parser = BeautifulSoup(req.data)

print("Title is: "+str(soup_parser.title))
print("Content is: "+str(soup_parser.get_text()))
Python
similarly, a script with the same functionality but using Requests is:
import requests
from bs4 import BeautifulSoup

req = requests.get('https://madhatlabs.com')
soup_parser = BeautifulSoup(req.content)

print("Title is: "+str(soup_parser.title))
print("Content is: "+str(soup_parser.get_text()))
Python
We have only made a simple HTTP request for the website front page but we are already one line shorter. The Requests library handles a lot of stuff like Keep-Alive, connection poolings, SSL, authentication, and other modern web concepts and functionality.

2. Scrapy

Scrapy is one of the python libraries that provides an easy way to create website scrapers for web crawling. It is easy to parse and pull data from websites and for that reason, we can easily make a simple spider to scrape the front page of a website.
import scrapy

class MadHatSpider(scrapy.Spider):
#name of the Spider
name='MadHatSpider'
#where to begin crawling
start_urls=['https://madhatlabs.com']

#function that takes the response and does things
def parse(self, response):
print(response.body)
Python

3. Pillow(PIL)

Pillow (PIL) is one of the python libraries that provides an easy way to interact and manipulate images. It provides easy ways to resize, rotate and manipulate the image overall.  PIL is one of the python libraries that is easy to use and below is a simple program to get the type and size of an image.
from PIL import Image
pic = Image.open("MadHat.jpg")

print(f"The format of this image is {pic.format} and its size is {pic.size}")
Python

4. SQLAlchemy

SQLAlchemy is one of the python libraries for database programming and it provides a programmatic way to access and interact with a SQL database. It also provides an Object Relational Mapper and also automates redundant tasks. As a result, the object model and database schema can be decoupled from the beginning of development. Above all, it is a powerful tool for SQL database interactions and below is a simple program to create a database with two tables.
import os
import sys
from sqlalchemy import Column, Integer, ForeignKey,String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine

MadHat= declarative_base()

class Person(MadHat):
__tablename__ = 'hat_wearer'

id = Column(Integer,primary_key=True)
first_name = Column(String(250),nullable=False)
last_name = Column(String(250),nullable=False)

class Hat(MadHat):
__tablename__ = 'hat'

id = Column(Integer,primary_key=True)
hat_color = Column(String(250))
person_id = Column(Integer,ForeignKey('hat_wearer.id'))
hat_wearer = relationship(Person)

hat_engine = create_engine('sqlite:///mad_hat.db')

MadHat.metadata.create_all(hat_engine)
Python

5. BeautifulSoup

BeautifulSoup is another one of the python libraries that provide web scraping and it provides a powerful but easy way to parse documents and traverse the document tree. It easily navigates and parses HTML and XML and as a result is powerful with websites and XML documents. It can save developers countless hours is simple to use. I have written a simple request and parser to find all hyperlinks in a website.
import requests
from bs4 import BeautifulSoup
website = 'https://madhatlabs.com'
req = requests.get(website)

soup_parser = BeautifulSoup(req.content)
print(f"Found all links in {website}")
for anchor in soup_parser.find_all('a',href=True):
print(f"{anchor['href']}")
Python

6. Twisted

Twisted is one the best python libraries for networking because it removes a lot of complexity in network programming. It is event-driven and makes it easy to add networking functionality to a python program. It also includes support for SSL, UDP, IMAP, SSHv2 and more. Above all, it is a simple but powerful way to add networking to python programs. Twisted is a strong addition to your libraries for application development and communication.
This is a simple server that observers for connections and prints out what it receives.
from twisted.internet import reactor, protocol

class Observer(protocol.Protocol):
"""Observes and prints the incoming data"""

    def dataReceived(self, data):
        print(data)

server= protocol.ServerFactory()
server.protocol = Observer
reactor.listenTCP(8000,server)
reactor.run()
Python
Similarly, this is the client that will connect and send a message to the server.
from twisted.internet import reactor, protocol

class SimpleProtocol(protocol.Protocol):

    defconnectionMade(self):
        print("Connection Made. Transmitting simple message.")
        self.transport.write(b"Simple Message")
        self.transport.loseConnection()

class SimpleClient(protocol.ClientFactory):

    protocol = SimpleProtocol

    def clientConnectionFailed(self, connector, reason):
        print("Connection failed. Shutting down.")
        reactor.stop()


    def clientConnectionLost(self, connector, reason):
        print("Connection lost. Shutting down.")
        reactor.stop()


client = SimpleClient()
reactor.connectTCP("localhost", 8000, client)
reactor.run()
Python

7. NumPy

The NumPy library is another one of the python libraries for data science that makes computation tasks in python easier. NumPy is useful for data science, data mining, linear algebra, N-dimension array calculations, and scientific applications. It provides easy ways to operate on N-dimension arrays such as matrix products.
import numpy as np
first_matrix = np.array([[1,1],[2,2]])
second_matrix = np.array([[1,2],[2,1]])
first_matrix.dot(second_matrix)
Python

8. Scapy

The Scapy library is one of the python libraries for networking but it allows a programmer to manipulate network packets similarly to Nmap or tcpdump.  Scapy also provides a way to do functionality other tools won’t like injecting custom 802.11 frames, sending invalid frames and more. Overall it is great for getting access and information to network packets but requires a greater knowledge of networking to fully take advantage of its capabilities in networking. A simpler TCP connect scanner is shown. Scapy is a great addition to any cyber security and security oriented collection of python libraries.
import sys

from scapy.all import sr1,IP,TCP
ip = input("What ip do you want to scan?")
active = sr1(IP(dst=ip)/TCP(dport=80,flags="S"))
if active:
    active.show()
Python

9. Pandas

Pandas is one of the python libraries for data science that provides an easy way to manipulate and prepare data for analysis. This is great for Data Mining, Machine Learning, Data Analysis and so much more. Due to Pandas’s capabilities in data preparation, it has become one of great python libraries for Machine Learning and Data mining. It allows a Python-centered workflow when doing data analysis in python.
Reading in a CSV file is as easy as:
import pandas as pd
csv_data = pd.read_csv('mycsvfile.csv')
Python
Similarly, it is just as simple to select and read the first 2 rows from the csv_data.
print(csv_data[:2])
Python

10. TensorFlow

TensorFlow is one of the python libraries for Machine Learning framework that makes it easier for developers to gain access to Machine Learning functions without the need to know the extensive mathematics behind the different machine learning models. The Tensorflow Library is a bit more extensive than a simple 20 line program to get some cool Machine Learning/Artificial Intelligence functionality working, but you can check out the article discussing it here Tensorflow and Keras QuickDive. Below I create two 1-D tensors and multiply them together.

import tensorflow as tf
first = tf.constant([4,3,2,1])
second = tf.constant([2,3,1,2])

result = tf.multiply(first,second)
session = tf.Session()

print(session.run(result))

session.close()
Python


11.Keras (Bonus)

The Keras library is a high-level neural network framework, one of the python libraries for machine learning,  that works with TensorFlow for Deep Learning(Insert link here to another post). Keras with TensorFlow can be used for rapid creation and testing of Deep Learning Models. It is worth noting that both Keras and Tensorflow are python libraries for machine learning, but Keras runs on top of Tensorflow.
These python libraries are far from an extensive list of great libraries to help speed up workflow. They are a great addition to any developer’s collection of use python libraries. I always suggest constant learning and integration of 3rd party software to maximize what someone can create. It is always important to follow the Object Oriented principle of DRY.

https://lauroperezjr.com/top-10-python-libraries

Thursday, May 21, 2020

Historical source code

https://computerhistory.org/blog/xerox-alto-source-code/?key=xerox-alto-source-code

HISTORICAL
SOURCE CODE RELEASES

Koja su lekovita svojstva heljde?

Jača organizam, podmlađuje krvne sudove, otklanja umor, zagreva, isušuje, povećava cirkulaciju u rukama i nogama, izgrađuje krv, povećava lučenje urina. Odlična je za pamćenje i koncentraciju (naročito za starije osobe). Snižava pritisak, leči arteriosklerozu i zatvor. Delotvorna je i u lečenju bolesti pluća i bubrega. Preporučuje se osobama s probavnim smetnjama, rekonvalescentima i starijim osobama. Doprinosi pravilnom radu creva, pogodna je za vegetarijansku ishranu (sadrži znatan procenat proteina).

Tuesday, May 19, 2020

The JavaScript Full-Stack Bootcamp

https://www.howtogeek.com/673729/heres-why-the-new-windows-10-terminal-is-amazing/




******************

https://www.trezor.gov.rs/files/services/espp/ostaledatoteke/ESPP%20-%20kratko%20uputstvo%20za%20korisnike%20v2.1.pdf

http://www.trezor.gov.rs/files/services/ispp/Uputstva%20za%20instalaciju/02.%20Uputstvo%20za%20izradu%20VPN%20konekcije.pdf

https://www.thoughtco.com/how-to-hook-the-mouse-1058467

****************

The JavaScript Full-Stack Bootcamp

This week I am super excited to announce that on Monday I'll open registrations to the JavaScript Full-Stack Bootcamp!
Registrations will be open from May 25 to June 1.
During the past few days I unlocked every day one module from the bootcamp.
You can check the free preview of the first 9 modules on the website.

Who is this bootcamp for?

Are you a total beginner? This bootcamp is perfect for you.

Are you an HTML/CSS person and want to step up your JS? This bootcamp is perfect for you.

Your JS is a bit rusty? This bootcamp is perfect for you.

You're a frontend dev and you want to get more fullstack/backend skills? This bootcamp is great for you.

Your favorite library is jQuery? This bootcamp is perfect for you to get into the more modern JS world.

Want to become ready to become a Vue/React/Angular master? This bootcamp is perfect for you to get the fundamentals right.

You're a backend dev and you want to get more frontend skills? This bootcamp is great for you

Pricing

I published the final pricing details on the website, including the student/PPP pricing and the weekly/monthly payment plans options.
Stay tuned! Just 6 days till we start!

New tutorials from the blog

This week I have 7 new blog posts.
I had a weird problem in Chrome, I woke up my computer from sleep and I got all the browser windows with a strange set of blue lines, making the page unreadable. Here's how I fixed the Chrome blue noise/lines rendering problem.
I' been working on improviding the Dark Mode appearance of a website I built. Here's how to change the favicon in dark mode using a simple SVG trick.
I got a question on what squashing Git commits means, so I wrote a tutorial.
Another question I got via Twitter DM was how to start freelancing as a developer. I wrote a few of the advice I wish someone gave me 10 years back. 
Recently I stumbled upon the "digital garden" concept, a way to describe a personal website. It resonated with me and I wrote my take on it.
Another question I got was, how to go from tutorials to making your own project. Great question. Hopefully I gave a good answer.
Last, I wrote what could be the start of a new software project: Sharing the Journey Towards Building a Software Product Business.
I got this idea of building a new product, and I'm documenting the process. I also made a video.
I made another video called 5 things I learned about SEO. Useful if you are into the blogging/content marketing sphere.
That's it for this week.
P.S. don't forget to follow me on Twitter to get daily tips and tricks and to subscribe to my YouTube channel!
Flavio

Thursday, May 14, 2020

An Excellent Open Source Projects

PASCAL

https://awesomeopensource.com/projects/pascal

https://kompjuteri2011.wordpress.com/2016/01/14/lazarus-tutorijal-08-odgovori-na-pitanja/

https://infossremac.wordpress.com/tag/lazarus/page/1/

https://violetakostadinovic.wordpress.com/iii-razred/

https://libre.lugons.org/index.php/2012/08/lazarus/


https://wiki.freepascal.org/Operating_Systems_written_in_FPC

https://wiki.freepascal.org/Game_Engine

https://wiki.freepascal.org/Games

https://wiki.freepascal.org/Lazarus_Application_Gallery

https://castle-engine.io/modern_pascal_introduction.html



RUST


https://github.com/maps4print/azul/wiki/Installation

https://azul.rs/

https://areweguiyet.com/


++
Here are this week's five links that are worth your time:

1. What is Agile software development? Here are the basic principles. (7 minute read): https://www.freecodecamp.org/news/what-is-agile-and-how-youcan-become-an-epic-storyteller/

2. How to write freelance web development proposals that will win over clients. And this includes a downloadable template, too. (7 minute read): https://www.freecodecamp.org/news/free-web-design-proposal-template/

3. What is Deno – other than an anagram of the word "Node"? It's a new security-focused TypeScript runtime by the same developer who created Node.js. And freeCodeCamp just published an entire Deno Handbook, with tutorials and code examples. (20 minute read): https://www.freecodecamp.org/news/the-deno-handbook/

4. This free course will show you how to use SQLite databases with Python (90 minute watch): https://www.freecodecamp.org/news/using-sqlite-databases-with-python/

5. You may have heard that there are a ton of free online university courses you can take while staying at home during the coronavirus pandemic. But did you know that 115 of them also offer free certificates of completion? Here's the full list. (Browsable list): https://www.freecodecamp.org/news/coronavirus-coursera-free-certificate/


Quote of the Week: "Planning is everything. Plans are nothing." - Helmuth von Moltke


Happy coding.

- Quincy Larson

Tuesday, May 12, 2020

Moja FM radio stanica

https://www.electronicsforu.com/electronics-projects/hardware-diy/medium-power-fm-transmitter




Jednu čajnu kašičicu mlevenog muskatnog oraha prelijte sa pola čaše ključale vode. Ostavite 45 min da odstoji. Dodajte malo meda. Popijte napitak 15 minuta pre jela ili pre spavanja. Terapija traje tri meseca.

The Deno Handbook

I got a new free ebook this week, it's about Deno, the Node.js... how to call it? Alternative? Modern take? Announced almost 2 years ago by Ryan Dahl, the creator of Node.js, will soon reach version 1.0, and I spent a few days learning it - and I wrote a longish tutorial on it.
I really like many little things about Deno, and the TypeScript first-class support is one of those. Plus all the alternative takes to what Ryan believes were mistakes in Node.js.
I like what I saw, but of course it's very early and you definitely should use Node.js if you are just starting out. The ecosystem and the community around Node is too huge to even be comparable. I just found it very cool, and I like to play with cool things.

The JavaScript Full-Stack Bootcamp

I have an update on my upcoming JavaScript Bootcamp. I published 4 free modules:
and I made a YouTube playlist where I go through each of those modules myself.
This week I'll add 3 more free modules, and next week 5 new ones. (I'll send you 12 free modules in total).
Registration to the bootcamp will be open for 8 days, from May 25 until Jun 1.
This is a very comprehensive, deep and practical training program with a high level of involvement. We start from the basics and we'll quickly build up from there.
It's the biggest things I've ever worked on, and I'm super excited to get this started!
Read more on thejsbootcamp.com

New blog posts

This week I have, in addition to the Deno Handbook, 6 new blog posts:

That's it for this week. See you next Tuesday!
P.S. don't forget to follow me on Twitter to get daily tips and tricks!
Flavio