Skip to content

Instantly share code, notes, and snippets.

View cartershanklin's full-sized avatar

Carter Shanklin cartershanklin

  • Oracle
  • Mountain View, CA
View GitHub Profile
@cartershanklin
cartershanklin / DataAnalysis.ipynb
Created October 23, 2023 18:28
OCI Data Flow Data Science Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cartershanklin
cartershanklin / dump_all_iam_statements.sh
Created December 23, 2021 18:01
Dump all OCI IAM policy statements. Helps track down policies that grant you unexpected and unwanted access.
#!/bin/sh
set -x
# Get all OCI IAM policy statements.
# Run as an Admin.
OUTPUT_FILE=all_iam_statements_$(date +'%Y-%m-%d').txt
rm -f $OUTPUT_FILE
#!/usr/bin/env python3
import argparse
import os
import sys
import oci
import oci_dataflow
from pyspark import SparkConf
from pyspark.sql.functions import udf
@cartershanklin
cartershanklin / deploy_dataflow
Last active March 6, 2024 12:15
Deploy OCI Data Flow Applications Easily
#!/usr/bin/env python3
# Deploy OCI Data Flow Applications easier.
#
# Features:
# Interactive compartment and bucket picker.
# Checksigs your script and archive and adds this to you Application name.
# Skips uploads when possible.
# Auto-detects your parameters and prompts you for defaults (SQL Only).
# Fail-fast option for completely headless operation.
import argparse
import oci
import os
import pathlib
import pandas as pd
from pyspark import SparkConf
from pyspark.sql import SparkSession
from sklearn import svm, preprocessing
from sklearn.model_selection import GridSearchCV as GridSearchCVNative
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 12 columns, instead of 2. in line 9.
street,city,zip,state,beds,baths,sq__ft,type,sale_date,price,latitude,longitude
3526 HIGH ST,SACRAMENTO,95838,CA,2,1,836,Residential,Wed May 21 00:00:00 EDT 2008,59222,38.631913,-121.434879
51 OMAHA CT,SACRAMENTO,95823,CA,3,1,1167,Residential,Wed May 21 00:00:00 EDT 2008,68212,38.478902,-121.431028
2796 BRANCH ST,SACRAMENTO,95815,CA,2,1,796,Residential,Wed May 21 00:00:00 EDT 2008,68880,38.618305,-121.443839
2805 JANETTE WAY,SACRAMENTO,95815,CA,2,1,852,Residential,Wed May 21 00:00:00 EDT 2008,69307,38.616835,-121.439146
6001 MCMAHON DR,SACRAMENTO,95824,CA,2,1,797,Residential,Wed May 21 00:00:00 EDT 2008,81900,38.51947,-121.435768
5828 PEPPERMILL CT,SACRAMENTO,95841,CA,3,1,1122,Condo,Wed May 21 00:00:00 EDT 2008,89921,38.662595,-121.327813
6048 OGDEN NASH WAY,SACRAMENTO,95842,CA,3,2,1104,Residential,Wed May 21 00:00:00 EDT 2008,90895,38.681659,-121.351705
2561 19TH AVE,SACRAMENTO,95820,CA,3,1,1177,Residential,Wed May 21 00:00:00 EDT 2008,91002,38.535092,-121.481367
11150 TRINITY RIVER DR Unit 114,RANCHO CORDOV
@cartershanklin
cartershanklin / data_flow_tutorial_ex1.py
Last active March 6, 2024 12:15
OCI Data Flow Tutorial Example 1 using the Python SDK
#!/usr/bin/env python
# This script executes Example 1 of the OCI Data Flow Tutorial
# https://docs.cloud.oracle.com/en-us/iaas/data-flow/data-flow-tutorial/tutorial/dfs_tut_etl_java.htm#etl_with_java
import argparse
import oci
import sys
import time
@cartershanklin
cartershanklin / data_flow_tutorial_ex1.sh
Last active March 6, 2024 12:15
OCI Data Flow Tutorial Example 1 using the OCI CLI
#!/usr/bin/env bash
# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
#
# This script executes Example 1 of the Data Flow Tutorial
# https://docs.cloud.oracle.com/en-us/iaas/data-flow/data-flow-tutorial/tutorial/dfs_tut_etl_java.htm#etl_with_java
#
# For more help with specific Data Flow commands, see:
# oci data-flow -h
#
@cartershanklin
cartershanklin / func.py
Last active December 16, 2022 18:54
Call OCI Data Flow from Oracle Functions
import io
import json
import logging
import oci
import os
import requests
import sys
from fdk import response
from oci.signer import Signer