Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Martin Gaido martingaido

💭
I may be slow to respond.
View GitHub Profile
@martingaido
martingaido / biorhythm.py
Created Dec 3, 2022
Script to calculate your biorhythm
View biorhythm.py
from datetime import datetime, timedelta
import math
def calculate_biorhythm(birthday, current_date, rhythm_type):
days_difference = (current_date - birthday).days
if rhythm_type == 'physical':
cycle = 23
elif rhythm_type == 'emotional':
@martingaido
martingaido / lambdaTweetScraper.py
Last active Nov 30, 2022
AWS Lambda Function to Scrape Tweets
View lambdaTweetScraper.py
import json
import snscrape
import snscrape.modules.twitter as sntwitter
import snscrape.modules.facebook as snfacebbok
import snscrape.modules.instagram as sninstagram
import snscrape.modules.mastodon as snmastodon
import snscrape.modules.reddit as smreddit
def lambda_handler(event, context):
@martingaido
martingaido / Iris.csv
Last active Nov 9, 2022
Deep Learning with Keras on Iris Dataset
View Iris.csv
Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm Species
1 5.1 3.5 1.4 0.2 Iris-setosa
2 4.9 3.0 1.4 0.2 Iris-setosa
3 4.7 3.2 1.3 0.2 Iris-setosa
4 4.6 3.1 1.5 0.2 Iris-setosa
5 5.0 3.6 1.4 0.2 Iris-setosa
6 5.4 3.9 1.7 0.4 Iris-setosa
7 4.6 3.4 1.4 0.3 Iris-setosa
8 5.0 3.4 1.5 0.2 Iris-setosa
9 4.4 2.9 1.4 0.2 Iris-setosa
@martingaido
martingaido / text-generator-transformers.py
Created Nov 9, 2022
Generating Human-level Text with Contrastive Search in Transformers
View text-generator-transformers.py
# pip install torch
# pip install "transformers==4.24.0"
# usage: python text-generator-transformers.py 'some text'
import sys
import torch
from transformers import GPT2Tokenizer, GPT2LMHeadModel
arg = sys.argv
@martingaido
martingaido / TaskSmartContract.sol
Created Jan 19, 2022
CRUD example using Solidity
View TaskSmartContract.sol
pragma solidity ^0.8.6;
contract TaskCrud {
struct Task {
uint id;
string name;
string description;
}
@martingaido
martingaido / HandsTracker.py
Created Mar 27, 2021
Hands Tracker using OpenCV & MediaPipe
View HandsTracker.py
# pip install mediapipe
import cv2
import mediapipe as mp
import time
cap = cv2.VideoCapture(0)
mpHands = mp.solutions.hands
hands = mpHands.Hands() # using default paramaters of 'Hands()'
mpDraw = mp.solutions.drawing_utils
@martingaido
martingaido / speedtest.py
Last active Jan 5, 2021
Test Internet Connection Speed
View speedtest.py
# pip install speedtest-cli
import speedtest
test = speedtest.Speedtest()
down = test.download()
upload = test.upload()
print(f"Download Speed: {down}")
print(f"Upload Speed: {upload}")
@martingaido
martingaido / colorDetectionCam.py
Created Aug 29, 2020
Color Detection/Filter using OpenCV and Webcam
View colorDetectionCam.py
# Color Detection/Filter using OpenCV and Webcam
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()
hsv_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
@martingaido
martingaido / covidPredictor.py
Created Aug 25, 2020
COVID-19 Predictor - Polynomial Regression
View covidPredictor.py
# COVID-19 cases predictor (polynomial regression for non-linear prediction)
# Data Source: https://ourworldindata.org/coronavirus-source-data
# Data Example
# id,cases
# 1,1
# 2,4
# 3,6
# 4,8
# 5,10
@martingaido
martingaido / house-prices.py
Created Aug 25, 2020
Predict House prices using linear regression
View house-prices.py
## Predict House prices using linear regression
## Dataset: https://www.kaggle.com/rubenssjr/brasilian-houses-to-rent
import pandas as pd
from sklearn import preprocessing, linear_model
import numpy as np
import sklearn
### Loading Data ###
print('-' * 30); print(' Importing Data ...'); print('-' * 30)