Skip to content

Instantly share code, notes, and snippets.

View sonpython's full-sized avatar
🎯
Focusing

Michael Phan sonpython

🎯
Focusing
View GitHub Profile
@sonpython
sonpython / 0x00D15422268E29447c851a684594FD06fEab5F55
Created October 1, 2017 03:36
0x00D15422268E29447c851a684594FD06fEab5F55
0x00D15422268E29447c851a684594FD06fEab5F55
@sonpython
sonpython / Eoddata.py
Last active April 20, 2017 18:36
eoddata.com soap API wrapper
from zeep import Client
WSDL_URL = 'http://ws.eoddata.com/data.asmx?wsdl'
class Eoddata():
'''
usage:
eod = Eoddata(username,password)
result = eod.send_request(action='Membership')
@sonpython
sonpython / GoogleDriveGetSlides.py
Created April 7, 2017 17:54
list and get slide + thumbnail in google drive
from __future__ import print_function
import httplib2
from apiclient import discovery
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect
from oauth2client.client import flow_from_clientsecrets, OAuth2WebServerFlow
from oauth2client.contrib import xsrfutil
from oauth2client.contrib.django_util.storage import DjangoORMStorage
def share_facebook_fanpage(link,msg,PAGE_ID,OAUTH_ACCESS_TOKEN,apiversion='v2.8'):
BASE_URL = "https://graph.facebook.com/%s" % apiversion
POST_URL = "%s/%s/feed" % (BASE_URL, PAGE_ID)
# force facebook scape the link first to avoid not showing thumb
f = requests.post(BASE_URL, data={
'id': link,
'scrape': True,
'access_token': OAUTH_ACCESS_TOKEN
})
__author__ = "Mark Allan B. Meriales"
# based from http://www.pythoncentral.io/watermark-images-python-2x/
# mine uses a picture as a watermark
# michaelphan add base_ratio for logo and better logo scale
from PIL import Image, ImageEnhance
def add_watermark(image_file, logo_file, opacity=1):
img = Image.open(image_file).convert('RGB')