Skip to content

Instantly share code, notes, and snippets.

import requests
import uuid
import time
import json
from random import *
import hmac
import hashlib
import urllib3
import urllib.parse
from urllib.parse import urlparse
@luapz
luapz / Triangular-Arbitrage.py
Created July 15, 2018 13:57 — forked from kukushi/Triangular-Arbitrage.py
Binance Triangular Arbitrage
import requests
import datetime
import operator
host = 'https://api.binance.com'
priceURL = host + '/api/v3/ticker/price'
priceResponse = requests.get(priceURL)
priceResponseJSON = priceResponse.json()
# {'symbol': 'ETHBTC', 'price': '0.07608700'}: 1 ETH = 0.0760 BTC
#coding: utf-8
from cStringIO import StringIO
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
from email import Charset
from email.generator import Generator
import smtplib
# Example address data
#!/usr/bin/env python2
# coding: utf-8
from __future__ import print_function
import os
import sys
from wand.image import Image
DIMENSIONS = {
'OSX': [
('icon_16x16.png', 16),
@luapz
luapz / client.py
Last active August 29, 2015 14:10 — forked from micktwomey/client.py
import socket
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 9000))
data = "some data"
sock.sendall(data)
result = sock.recv(1024)
print result
sock.close()
@luapz
luapz / form.py
Created April 9, 2013 15:14 — forked from dahlia/form.py
from flask import current_app, request, url_for
from formencode.htmlfill import render
from formencode.api import Invalid
from jinja2 import Markup, Undefined
from jinja2.exceptions import TemplateSyntaxError
from jinja2.ext import Extension
from jinja2.nodes import (Const, Filter, FilterBlock, Keyword, Output,
TemplateData)
from werkzeug.utils import escape
# -*- python -*-
# vim: ts=4 sw=4 sts=4 expandtab syntax=python
# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory.
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
import os
__basedir__ = os.path.abspath(os.path.dirname(__file__))
@luapz
luapz / detect.py
Created February 2, 2013 14:30 — forked from LeZuse/detect.py
browser = request.user_agent.browser
version = request.user_agent.version and int(request.user_agent.version.split('.')[0])
platform = request.user_agent.platform
uas = request.user_agent.string
if browser and version:
if (browser == 'msie' and version < 9) \
or (browser == 'firefox' and version < 4) \
or (platform == 'android' and browser == 'safari' and version < 534) \
or (platform == 'iphone' and browser == 'safari' and version < 7000) \
#!/usr/bin/env python
import sys, os
import hashlib
import zipfile
VENDORS = {
# vendor desc : vendor id
'Google Inc.' : 'google',
'LG Electronics' : 'lge',
'Intel Corporation': 'intel_corporation',
@luapz
luapz / gist:4564694
Created January 18, 2013 13:56
Sending Emails Via Gmail SMTP With Python
#!/usr/bin/python
import smtplib
SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = 587
sender = 'you@gmail.com'
recipient = 'user@example.com'
subject = 'Gmail SMTP Test'
body = 'blah blah blah'