Skip to content

Instantly share code, notes, and snippets.

View thehapyone's full-sized avatar
🤯
Exploring

Ayo Ayibiowu thehapyone

🤯
Exploring
View GitHub Profile
@thehapyone
thehapyone / apartment_scapper.py
Last active August 4, 2021 11:16
Get new first hand apartments notification from AWS SNS
import json
from typing import Optional, Union, Tuple, NamedTuple
import hashlib
import logging
import os
import boto3
import requests
from bs4 import BeautifulSoup, NavigableString, Tag
logger = logging.getLogger("scrapper_logger")
@thehapyone
thehapyone / Woocommerce_subscription_cancellation_period.php
Last active June 18, 2020 09:39
revents customer from cancelling the Woocommerce subscription until after a duration.
/**
* Prevents customer from cancelling the Woocommerce subscription until after a duration.
* For example a period of 2 months after the subscription got active before enabling the user to be able to cancel it.
* This code will remove the subscription cancel button until that grace period has been used.
*/
function eg_remove_my_subscriptions_button( $actions, $subscription ) {
// Get the current active user
$user_id = wp_get_current_user();
@thehapyone
thehapyone / fisher_ratio.py
Last active October 28, 2019 15:22
Calculates the Fisher Discriminating Ratio For a training data useful for Feature Selection in machine learning.
import numpy as np
import pandas as pd
# Fisher Index Calculation Helper Function - Can calculate for any number of features and classes.
# Input parameter is Training Set and Label Set.
# The training input set should be a 2D array
# i.e (Examples by Features) - Examples on rows, features on colms E.g (400 by 30)
# Label set should be a 2D array of size - (examples by 1). i.e 1 column.
# The function will return a vector of the fisher ratios.
# Requirements Library - Pandas and Numpy