Skip to content

Instantly share code, notes, and snippets.

@peterlyeung
peterlyeung / sfdc.py
Created July 18, 2018 02:59
Lambda function to copy files from a SFTP server and add it to Salesforce as an attachment
import paramiko
import requests
import base64
import json
from simple_salesforce import Salesforce
#---------------------------------
# FTP portion
#---------------------------------
@peterlyeung
peterlyeung / Rekognition.py
Created March 16, 2018 03:18
Use CV to grab iPhone mirrored on screen to get screenshots and then send to Rekognition using the boto library to train engine.
#----------------------------------------------------------------------------_
# This script can be ran in 2 modes:
# python play.py train
# or
# python play.py Run
#
# Use the training mode to train the AI.
# Once the AI has been trained, then run it in the play mode. The matching screenshot
# from the learning mode will be displayed on screen.
#-----------------------------------------------------------------------------
@peterlyeung
peterlyeung / Connecting Jupyter to Salesforce for Data Analysis.ipynb
Created November 14, 2017 02:52
Connecting Jupyter Notebook to Salesforce
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@peterlyeung
peterlyeung / reportfields.py
Created April 1, 2015 16:46
Python script to parse SFDC metadata on reports to determine which fields are being used.
#!/usr/bin/python
#---------------------------------------------------------------------------
# This python script traverses the reports directory of the SFDC metadata.
# It goes through each directory and reports, and pulls out fields
# used in the report. A file called reporting_fields_used.csv is generated.
#---------------------------------------------------------------------------
import os
import sys
import xml.etree.ElementTree as ET
from StringIO import StringIO