Skip to content

Instantly share code, notes, and snippets.

View storenth's full-sized avatar

Kirill Zhdanov storenth

View GitHub Profile
@storenth
storenth / ScreenAnalysis.py
Created May 12, 2018 13:28 — forked from rinchik/ScreenAnalysis.py
Analyzing and finding differences between 2 screenshots captured with Selenium in Python
from PIL import Image, ImageDraw
from selenium import webdriver
import os
import sys
class ScreenAnalysis:
STAGING_URL = 'http://www.yahoo.com'
PRODUCTION_URL = 'http://www.yahoo.com'
driver = None
@storenth
storenth / CapitalOneInvestingSeleniumLoging.py
Created May 12, 2018 13:31 — forked from rinchik/CapitalOneInvestingSeleniumLoging.py
Capital One Investing login from the home page method
def login(self):
print 'Login ...'
self.driver.get(self.capital_url) # capital_url - Capital One Investing home page url
username_field = self.driver.find_element_by_css_selector('input#widget_signInUsername')
username_field.clear() # clear() is required for their form or send_key() below will fail
username_field.send_keys(self.username)
password_field = self.driver.find_element_by_css_selector('input#widget_signInPassword')
password_field.clear()
password_field.send_keys(self.password)
submit = self.driver.find_element_by_css_selector('#widget > div.SignInButtonWrapper > div.SignIn > a')
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from datetime import datetime
class BruteForce:
URL = 'http://localhost:3333'
character_list = 'abcdefghijklmnopqrstuvwxyz'
@storenth
storenth / SeleniumClicks.py
Created May 12, 2018 13:38 — forked from rinchik/SeleniumClicks.py
Double-click + click in Python Selenium for rich tables editing
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
def enter_hours(self, cell, amount):
#Double-click
actions = ActionChains(self.driver)
actions.move_to_element(cell)
actions.double_click(cell)
actions.perform()
@storenth
storenth / drag_and_drop_helper.js
Created June 7, 2018 15:46 — forked from rcorreia/drag_and_drop_helper.js
drag_and_drop_helper.js
(function( $ ) {
$.fn.simulateDragDrop = function(options) {
return this.each(function() {
new $.simulateDragDrop(this, options);
});
};
$.simulateDragDrop = function(elem, options) {
this.options = options;
this.simulateEvent(elem, options);
};
import alpaca_trade_api as tradeapi
api = tradeapi.REST(key_id=<your key id>,secret_key=<your secret key>)
class positionHandler:
def __init__(self,startingBalance=10000,liveTrading=False):
self.cashBalance = startingBalance
self.livePositions = {} # Dictionary of currently open positions
self.openOrders = [] # List of open orders
self.positionHistory = [] # List of items [Symbol, new position size]

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites

@storenth
storenth / Vagrantfile
Last active November 22, 2018 13:53
[vagrant] linux host setup with windows 10 guest
# -*- mode: ruby -*-
# vi: set ft=ruby :
# vagrant box
# https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
#$script = <<-SCRIPT
#/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe New-Item -ItemType directory -Path "C:\Users\IEUser\vagrant_data\new_powershell"
#python vagrant_data\test_python.py
#SCRIPT
@storenth
storenth / client.py
Created December 10, 2018 11:15 — forked from abendayan/client.py
p2p
#!/usr/bin/env python
"""UDP hole punching client."""
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import time
import sys
class ClientProtocol(DatagramProtocol):
"""
@storenth
storenth / p2p-vs-clientserver.py
Created December 10, 2018 11:18 — forked from oalee/p2p-vs-clientserver.py
p2p vs client server time
# -*- coding: utf-8 -*-
"""
Spyder Editor
"""
import plotly.offline as py
import plotly.graph_objs as go