Skip to content

Instantly share code, notes, and snippets.

View jamesanto's full-sized avatar

James A jamesanto

View GitHub Profile
@jamesanto
jamesanto / attempt1.py
Last active February 8, 2024 16:56
Stock Prediction
import csv
import math
import os.path
from calendar import monthrange, isleap
from datetime import datetime, date
from typing import List
import lightning as L
import torch
import torch.nn as nn
@jamesanto
jamesanto / Filter2FilterTest.scala
Created July 23, 2019 13:07
Generic Services & Filters based on Finagle, using ZIO
import org.scalatest.{FreeSpec, Matchers}
class Filter2FilterTest extends FreeSpec with Matchers with ZioTestSupport {
case class JsonErr()
case class JsonReq()
case class JsonRes()
@jamesanto
jamesanto / FlatMap.scala
Last active July 23, 2019 13:10
Generic Services & Filters based on Finagle
trait FlatMap[F[_]] {
def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B]
}
object OptionFlatMap extends FlatMap[Option]{
override def flatMap[A, B](fa: Option[A])(f: A => Option[B]): Option[B] = fa.flatMap(f)
}
//example for option
object option {
@jamesanto
jamesanto / Elevator.java
Created October 25, 2017 16:59
Elevator system design
public class Elevator {
private float location = 0;
private Direction direction = Direction.UP;
private State state = State.STOPPED;
private Door door = Door.CLOSED;
private Thread processingThread;
private Thread listeningThread;
public class Request {
public long time;
@jamesanto
jamesanto / MatrixUtils.java
Created October 25, 2017 16:56
Matrix rotation
public class MatrixUtils {
public static <T> boolean isSquareMatrix(T[][] matrix) {
if (matrix.length == 0) return true;
for (int i = 0; i < matrix.length; i++) {
if (matrix[i].length != matrix.length) return false;
}
return true;
}
package me.socure.service.pipl
/**
* Created by jamesanto on 10/12/15.
*/
object PersonUtil {
import scala.language.implicitConversions
import com.pipl.api.data.containers.Person
import scala.collection.JavaConverters._
package imp
/**
* Created by jamesanto on 10/7/15.
*/
object imps {
implicit val prefix: String = "Hello "
//implicit val tt: String = "Text"