This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.parse import urlparse | |
import re | |
import dataiku | |
import pandas as pd | |
PROJECT_ID = 'CUSTOMERSEGMENTATION' | |
ANALYSIS_ID = 'UjW24hJ1' | |
ML_TASK_ID = 'LsiobCLw' | |
MODEL_ID = 'A-CUSTOMERSEGMENTATION-UjW24hJ1-LsiobCLw-s1-pp1-m1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import StringIO | |
import logging | |
class StreamingLog(object): | |
def __init__(self, logger_name, level=logging.INFO): | |
self.stream = StringIO() | |
self.handler = logging.StreamHandler(self.stream) | |
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | |
self.handler.setFormatter(formatter) | |
self.log = logging.getLogger(logger_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(miniCRAN) | |
library(remotes) | |
# CRAN mirror to use (recommend checkpoint date for installed version of R https://mran.microsoft.com/timemachine) | |
cran_repo <- c(CRAN = "https://cran.microsoft.com/snapshot/2018-11-30") | |
# local path to create miniCRAN repo | |
miniCRAN_dir <- "/data/dataiku/miniCRAN" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
import functools | |
import json | |
import os | |
import requests | |
import urllib | |
import uuid | |
import configparser | |
# TODO: CURRENTLY ONLY WORKS FOR AWS, NEED TO ADD ADDITIONAL PARSING FOR AZURE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.core.magic import line_magic, line_cell_magic, Magics, magics_class | |
from pyspark.sql import SparkSession | |
from pyspark.dbutils import DBUtils | |
spark = SparkSession.builder.getOrCreate() | |
sc = spark.sparkContext | |
dbutils = DBUtils(sc) | |
@magics_class | |
class DatabricksConnectMagics(Magics): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# In[11]: | |
# dependencies | |
import pytesseract | |
from bs4 import BeautifulSoup | |
from PIL import Image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"***************************************************************************** | |
"" Vim-PLug core | |
"***************************************************************************** | |
if has('vim_starting') | |
set nocompatible " Be iMproved | |
endif | |
let g:vim_bootstrap_langs = "html, javascript,python,scala" | |
let g:vim_bootstrap_editor = "vim" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"***************************************************************************** | |
"" Vim-PLug core | |
"***************************************************************************** | |
if has('vim_starting') | |
set nocompatible " Be iMproved | |
endif | |
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim') | |
let g:vim_bootstrap_langs = "html,javascript,python,scala" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o nounset -o errexit -o pipefail | |
IP_ADDR=$(/sbin/ifconfig eth0 | grep "inet addr" | cut -d ":" -f2 | cut -d " " -f1) | |
CONF_DIR="$HOME/.ipython/profile_default" | |
CONF_FILE="${CONF_DIR}/ipython_notebook_config.py" | |
mkdir -p "${CONF_DIR}" | |
cat <<EOF >>"${CONF_FILE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from io import BytesIO | |
import pyarrow as pa | |
import pyarrow.parquet as pq | |
kilobytes = 1024 | |
megabytes = kilobytes * 1000 | |
chunksize = int(10 * megabytes) |
NewerOlder