Skip to content

Instantly share code, notes, and snippets.

View taiwotman's full-sized avatar
🎯
Focusing

Taiwo O. Adetiloye taiwotman

🎯
Focusing
View GitHub Profile
/****************************************************************************
* Author: Alberto Gutiérrez Jácome <agjacome@gmail.com>
* Date: 16/09/2012
*
* Compilation: javac KdTree.java
* Execution: not applicable
* Dependencies: Point2D.java RectHV.java StdDraw.java Queue.java
*
* Description: A mutable data type that uses a 2d-tree to represent a set of
* points in the unit square. A 2d-tree is a generalization of a BST to
import org.apache.spark.mllib.clustering.KMeans
import org.apache.spark.mllib.linalg.Vectors
import org.apache.spark.sql.SQLContext
import org.apache.spark.{SparkConf, SparkContext}
/**
* Created by taiwoadetiloye on 2016-04-01.
*/
object kmeans extends App{
Sqoop is a tool designed to transfer data between Hadoop and relational database servers. For example between MySQL, Orable
to HDFS and HBASE
Clients access HBase through a Java API, a REST interface, a Thrift gateway, or the HBase shell command-line interface.
@taiwotman
taiwotman / __init__.py
Created April 30, 2020 16:07
Flasklogin-Neo4j key files
"""Initialize app."""
from flask import Flask
from .flask_py2neo import Py2Neo
from flask_login import LoginManager
from . import routes
from . import auth
db = Py2Neo()
login_manager = LoginManager()
@taiwotman
taiwotman / __init__.py
Last active April 30, 2020 16:24
Flasklogin-Neo4j key files
"""Initialize app."""
from flask import Flask
from .flask_py2neo import Py2Neo
from flask_login import LoginManager
from . import routes
from . import auth
db = Py2Neo()
login_manager = LoginManager()
@taiwotman
taiwotman / flasks_py2neo.py
Last active December 31, 2022 15:45
FlaskLogin Neo4j
from __future__ import absolute_import
from flask import current_app
from py2neo import Graph
import os
username = os.environ.get('NEO4J_USERNAME')
password = os.environ.get('NEO4J_PASSWORD')
class Py2Neo(object):
def __init__(self, app=None):
"""Database models"""
from . import db
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from py2neo import Node
from py2neo.ogm import GraphObject, Property
from datetime import datetime
class User(UserMixin, GraphObject):
"""Model for user accounts."""
"""App entry point."""
from application import create_app
app = create_app()
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True)
@taiwotman
taiwotman / test.py
Last active March 15, 2021 15:44
Solution1
###
## Author: Taiwo O. Adetiloye
## Date: Aug 28, 2020
## Solution 1
###
''' Corner cases
1. If the prefix_length is greater that the length of the key prefix,
then the formulation would be distorted
2. The dictionary is not ideal for situation where the
@taiwotman
taiwotman / rds_sql1.sql
Last active December 17, 2020 22:35
AWS REDSHIFT SQL
create table seattle_emergence_calls(
incident_number varchar,
address varchar,
type varchar,
call_date varchar,
latitude varchar,
longitude varchar,
report_location varchar
);