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
import numpy as np | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
class Pub: | |
def __init__(self, mu: float, sigma: float): | |
self.mu = mu | |
self.sigma = sigma | |
self.n = 0 | |
self.total_score = 0 |
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
[loggers] | |
keys=root, alogger | |
[handlers] | |
keys=stream_handler | |
[formatters] | |
keys=formatter | |
[logger_root] |
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
import uuid | |
import requests | |
ENDPOINT = "https://todo.pixegami.io" | |
class TaskUtility: | |
@staticmethod | |
def new_task_payload(): | |
user_id = f"test_user_{uuid.uuid4().hex}" |
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
import pytest | |
from unittest.mock import Mock | |
from unittest_examples import Flight, CustomerDb | |
@pytest.fixture | |
def app(): | |
plane = Flight(5, 10) | |
plane.add_passenger("Cristiano Ronaldo") | |
plane.add_passenger("Ten Hag") | |
plane.add_passenger("Harry Maguire") |
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 typing import List | |
class CustomerDb: | |
def __init__(self): | |
print("Connected to db") | |
def get_customer_membership(self, name: str) -> int: | |
if name == "Cristiano Ronaldo": | |
return 2 |
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
import asyncio | |
async def get_data_from_db(): | |
print("connecting to database...") | |
await asyncio.sleep(3) | |
print('data is retrieved.') | |
return {'data': 'myData'} | |
async def counter(): |
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 Memento(): | |
def __init__(self, state): | |
self.state = state | |
print(f"I am a Memento and my state is {self.state}") | |
class Originator(): | |
def __init__(self): | |
self._state = "" |
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
import org.apache.spark.sql.SparkSession | |
import org.apache.log4j._ | |
Logger.getLogger("org").setLevel(Level.ERROR) | |
//start a spark session | |
val spark = SparkSession.builder().getOrCreate() | |
//read data | |
val logregdata = spark.read.option("header","true").option("inferSchema","true").format("csv").load("titanic.csv") | |
val data = logregdata.na.drop() |
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
import laspy as lp | |
import numpy as np | |
import open3d as o3d | |
path = "NZ19_Wellington.las" | |
#read point cloud data | |
point_cloud=lp.read(path) | |
#convert to o3d |
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
import numpy as np | |
import open3d as o3d | |
#get point cloud data | |
armadillo = o3d.data.ArmadilloMesh() | |
mesh = o3d.io.read_triangle_mesh(armadillo.path) | |
N = 2000 #point | |
pcd = mesh.sample_points_poisson_disk(N) | |
# fit to unit cube | |
pcd.scale(1 / np.max(pcd.get_max_bound() - pcd.get_min_bound()), |
NewerOlder