Skip to content

Instantly share code, notes, and snippets.

View firesofmay's full-sized avatar

Mayank Jain firesofmay

View GitHub Profile
#Py code
import cProfile
import urllib2
def main():
urllib2.urlopen('http://majorgeeks.com/page.php?id=1')
if __name__ == '__main__':
cProfile.run('main()')
main()
#Py Code tested
import urllib2
import cProfile
def main():
url = "http://majorgeeks.com/page.php?id="
for i in xrange(1,21):
tempurl = url + str(i)
res = urllib2.urlopen(tempurl)
(defn getepoch [timestamp]
(int (/ (.getMillis timestamp) 1000)))
@firesofmay
firesofmay / gist:3271980
Created August 6, 2012 07:44
Code to select iFrame and input text inside of it.
(switch-to-frame 0)
(switch-to-active)
(send-keys "body" "Thanks to noidi_ :)")
(switch-to-default) ;This is switch back from iframe.
(click (find-element {:tag :button :type :submit})) ;to submit :)
@firesofmay
firesofmay / gist:3386131
Created August 18, 2012 11:08
Saving test output to a string
(def msg (let [s (java.io.StringWriter.)]
(binding [*test-out* s]
(with-test-out (run-tests)))
(str s)))
;Thanks to jjcomer at #clojure IRC.
(ns ff.core
(require [clj-webdriver.taxi :as taxi]
[clj-webdriver.firefox :as ff]))
(def path-firebug "ff-extensions/firebug@software.joehewitt.com.xpi")
(defn init-firefox-local-driver
"Initializes Firefox driver.
And sets a global implicit-wait"
from BeautifulSoup import BeautifulSoup
import requests
url = "http://www.the-numbers.com/movie/%s"
payload = "Die-Hard-5"
cast = list()
technicals = list()
r = requests.get(url % payload )
soup = BeautifulSoup(r.text)
#!/bin/bash
# Imports pictures into all iOS simulators.
path_to_pic="src/ios/pictures/"
mkdir -p /Users/$(whoami)/Library/Application\ Support/iPhone\ Simulator/{5.0,5.1,6.0,6.1}/Media/DCIM/100APPLE/
find ~/Library/Application\ Support/iPhone\ Simulator/ -type d -name '100APPLE' -exec cp /Users/$(whoami)/$path_to_pic/* {} \;
@firesofmay
firesofmay / ouput.txt
Created April 21, 2013 09:20
Saucelabs remote clj-webdriver test sample code.
testclj.core> (start)
----------------------------
{platform WIN8, browserName firefox, version 21}
Browser firefox
Version 21.0
Platform #< XP>
----------------------------
{platform VISTA, browserName firefox, version 21}
Browser firefox
Version 21.0
@firesofmay
firesofmay / gist:5968289
Created July 10, 2013 17:28
Git Pretty Log Coloumn Output
git log --pretty=format:'%h|%ad|%an|%s' -20 --date=local | awk -F '|' '{ printf "%s %s %-20s %s\n", $1, $2, $3, $4 }'