Skip to content

Instantly share code, notes, and snippets.

View dkatz23238's full-sized avatar
🏠
Working from home

David Emmanuel Katz dkatz23238

🏠
Working from home
View GitHub Profile
@dkatz23238
dkatz23238 / logo.svg
Created June 25, 2024 21:49
Noves logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dkatz23238
dkatz23238 / california_counties.sql
Created April 20, 2024 16:55
california_counties.sql
This file has been truncated, but you can view the full file.
SET standard_conforming_strings = OFF;
DROP TABLE IF EXISTS "public"."california_counties" CASCADE;
DELETE FROM geometry_columns WHERE f_table_name = 'california_counties' AND f_table_schema = 'public';
BEGIN;
CREATE TABLE "public"."california_counties" ( "ogc_fid" SERIAL, CONSTRAINT "california_counties_pk" PRIMARY KEY ("ogc_fid") );
SELECT AddGeometryColumn('public','california_counties','wkb_geometry',4326,'MULTIPOLYGON',2);
CREATE INDEX "california_counties_wkb_geometry_geom_idx" ON "public"."california_counties" USING GIST ("wkb_geometry");
COMMENT ON TABLE "public"."california_counties" IS NULL;
ALTER TABLE "public"."california_counties" ADD COLUMN "county_nam" VARCHAR(40);
ALTER TABLE "public"."california_counties" ADD COLUMN "county_abb" VARCHAR(3);
import numpy as np
# ROD, PB, PE, DivP, netIncomeTTM, ROA
px_0 = np.array([40, 40, 40, 40, 40, 40])
px_1 = np.array([-49.54, -37.51, -16.38, 3.82, 27.54, 71.29])
pc_0 = 0.01
pc_1 = -0.02
@dkatz23238
dkatz23238 / main.py
Created March 11, 2023 16:53
Calling SML On Premises
import requests
# Load the image
img = open("image.png", "rb")
# Send image to the /predict endpoint
response = requests.post(
"http://localhost:8001/predict",
files={
"document_image": img
import numpy as np
import matplotlib
from matplotlib.axes import Axes
from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
import numpy as np
matplotlib.rcParams.update({'font.size': 48})
sqrt2pi = np.sqrt(2*np.pi)
@dkatz23238
dkatz23238 / agrobiz.py
Created July 8, 2022 01:46
Formulas for agro economics
# dc direct costs - usd/ha
# ps price soy - usd/tn
# qr cost of land in quintals of soy - qq/ha
# ya yield of the activity - qq/ha
# pa price of the activity if activity not soy - usd/tn
# td direction costs - percent
# fs fixed sharecropping - percent
# import numpy as np
# import matplotlib.pyplot as plt
@dkatz23238
dkatz23238 / sp.py
Created May 26, 2022 15:04
AI Research
n = 10
q = 2
potential_solutions = sum([comb(n, i) * (2 ** (q * i)) for i in range(n + 1)])

Place Holder

@dkatz23238
dkatz23238 / timeseries.js
Created January 13, 2022 21:20
Timeseries.js
/*
* @param {DateRange} index
*/
let invertIndex = (index) => {
let invIndex = {};
for (let i = 0; i < index.values.length; i++) {
invIndex[index.values[i]] = i;
}
return invIndex;
@dkatz23238
dkatz23238 / docker.bash
Last active January 17, 2022 13:52
Docker training 2022 scripts
# Run a container
docker run -it python:latest bash
# or
# will start the container using latest CMD or ENTRYPOINT
docker run -it python:latest
# Run dettach mode, if you don't the shell session will be attaced to the containers lifecycle
docker run -it -d python:latest
# Run with env --rm will remove the container upon exit of last proccess.
docker run --rm -it -e TRAINING_SESSION=DOCKER python:latest bash
# Create a directory to map a volume to and use in the container