This file contains hidden or 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 selenium import webdriver | |
| from selenium.webdriver.support.select import Select | |
| browser = webdriver.Firefox() | |
| browser.get('http://www.amxremit.com') | |
| # get the currency dropdown | |
| select = Select(browser.find_element_by_id("showrate")) | |
| select.select_by_index(3) #for INR currency |
This file contains hidden or 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/python2.7 | |
| import requests | |
| import datetime | |
| import smtplib | |
| import logging | |
| import re | |
| from email.mime.text import MIMEText | |
| from email.mime.multipart import MIMEMultipart | |
| sender = "uptimebot@test.com" |
This file contains hidden or 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/python | |
| import MySQLdb as mdb | |
| import sys | |
| import csv | |
| import smtplib | |
| from datetime import datetime | |
| from email.MIMEBase import MIMEBase | |
| from email.MIMEMultipart import MIMEMultipart | |
| from email import Encoders |
This file contains hidden or 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 requests | |
| def check(r): | |
| base_url = "http://www.letsrevolutionizetesting.com/challenge.json?id=" | |
| print "Hitting: %s" % r.url | |
| if 'follow' in r.json(): | |
| url_to_follow = r.json().get('follow') | |
| new_url = base_url + url_to_follow.split("=")[-1] | |
| check(requests.get(new_url)) | |
| else: |
This file contains hidden or 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
| # birthday problem - http://en.wikipedia.org/wiki/Birthday_problem | |
| def get_prob(n): | |
| p, i = 1.0, 0 | |
| while (i < n): | |
| p = p * (365 - i) / 365 | |
| i += 1 | |
| return (1 - p) | |
| def func_get_prob(n): |
This file contains hidden or 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
| There are 4 parts to successfully running django apps on nginx and gunicorn. | |
| 1. Set up gunicorn | |
| 2. Set up supervisor | |
| 3. Set up nginx. | |
| 4. Making admin staticfiles work | |
| Step 1 | |
| ==== | |
| Assuming you have gunicorn installed, just run your app using the command - gunicorn_django <ip_address:port> |
This file contains hidden or 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
| function [J, grad] = costFunctionReg(theta, X, y, lambda) | |
| m = length(y); % number of training examples | |
| J = 0; | |
| grad = zeros(size(theta)); | |
| [J, grad] = costFunction(theta, X,y); | |
| reg = ( (sum(theta.^2) - theta(1,1)^2) * (lambda/(2*m)) ) | |
| J = J + reg; | |
| for iter = 1:size(grad), | |
| if (iter) > 1, |
This file contains hidden or 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 sqlite3 | |
| class User(): | |
| def __init__(self, id, age, occupation, male): | |
| self.id = id | |
| self.male = male | |
| self.age = age | |
| self.occupation = occupation | |
| self.movie_ratings = {} | |
| self.set_movie_ratings() |
This file contains hidden or 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 sqlite3 | |
| class User(): | |
| def __init__(self, id, age, occupation, male): | |
| self.id = id | |
| self.male = male | |
| self.age = age | |
| self.occupation = occupation | |
| self.movie_ratings = {} |
This file contains hidden or 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
| git ls-files | grep '\.swp$' | xargs git rm |