This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* C++ demonstration of OOP Encapsulation principle. */ | |
#include <iostream> | |
using namespace std; | |
class Car { | |
public: | |
int number_of_wheels = 0; | |
int door_angle_opening_degrees = 85; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Vehicle { | |
public: | |
int number_of_wheels = 0; | |
public: | |
string turn_on_engine() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LOCAL MACHINE | |
ssh-keygen -t rsa -b 4096 -f /home/ivanleoncz/.ssh/mykey | |
# Generating public/private rsa key pair. | |
# Enter passphrase (empty for no passphrase): | |
# Enter same passphrase again: | |
# Your identification has been saved in /home/ivanleoncz/.ssh/mykey | |
# Your public key has been saved in /home/ivanleoncz/.ssh/mykey.pub | |
# The key fingerprint is: | |
# SHA256:1ATgW9Ly+FZU+gkX44mHKSYFp+/JAwHQHDpPkKoQRzg ivanleoncz@ilex-an5 | |
# The key's randomart image is: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Release Dec 1st, the stable release: https://pypi.org/project/pip-audit/ | |
# Announced by Dustin Ingram: https://twitter.com/di_codes/status/1466109133711724551 | |
# Output of executing pip-audit | |
$ pip-audit | |
WARNING:pip_audit._service.pypi:Warning: pip 20.0.2 doesn't support the `cache dir` subcommand, unable to reuse the `pip` HTTP cache and using "/home/ivanleoncz/.pip-audit-cache" instead | |
\ Auditing webencodings (0.5.1) | |
Found 26 known vulnerabilities in 4 packages | |
Name Version ID Fix Versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE ordered_products ( | |
id SERIAL PRIMARY KEY, | |
name VARCHAR(50), | |
department VARCHAR(50), | |
price INTEGER, | |
weight NUMERIC); | |
# Let's add some columns with TIMESTAMP data. | |
ALTER TABLE ordered_products ADD COLUMN created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP; | |
ALTER TABLE ordered_products ADD COLUMN updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Database Schema for simple studies of SQL, from Udemy's couse: | |
-- "SQL and Postgresql: The Developers Complete Developer's Guide" | |
-- This schema is used on the following website: https://pg-sql.com/ | |
CREATE TABLE users( | |
id SERIAL PRIMARY KEY, | |
username VARCHAR(50) | |
); | |
CREATE TABLE photos ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyIterator: | |
def __init__(self, limit): | |
self.limit = limit | |
def __iter__(self): | |
self.a = 1 | |
return self | |
def __next__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/python3 | |
""" Demonstration of logging feature for a Flask App. """ | |
from logging.handlers import RotatingFileHandler | |
from flask import Flask, request, jsonify | |
from time import strftime | |
__author__ = "@ivanleoncz" | |
import logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, jsonify, request | |
from jsonschema import Draft7Validator | |
app = Flask(__name__) | |
app.config["JSONIFY_PRETTYPRINT_REGULAR"] = True | |
schema = { | |
"type": "object", | |
"properties": { | |
"hospital": {"type": "string"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On local environemnt: loaded via python-dotenv. | |
# On Cloug FUnction: defined on Environment Variables section and automatically loaded for the Cloud Function. | |
DEFAULT_MESSAGE="You haven't provided a message." |