This file contains 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
// allows using all Jquery AJAX methods in Greasemonkey | |
// inspired from http://ryangreenberg.com/archives/2010/03/greasemonkey_jquery.php | |
// works with JQuery 1.5 | |
// (c) 2011 Martin Monperrus | |
// (c) 2010 Ryan Greenberg | |
// | |
// Usage: | |
// $.ajax({ | |
// url: '/p/', | |
// xhr: function(){return new GM_XHR();}, |
This file contains 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 java.util.ArrayList; | |
import java.util.List; | |
import org.mortbay.jetty.Connector; | |
import org.mortbay.jetty.Server; | |
import org.mortbay.jetty.handler.HandlerList; | |
import org.mortbay.jetty.handler.ResourceHandler; | |
import org.mortbay.jetty.nio.SelectChannelConnector; | |
import org.mortbay.jetty.servlet.ServletHandler; | |
import org.mortbay.jetty.servlet.ServletHolder; |
This file contains 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
/** | |
* This program makes a static analysis in | |
* order to extract method calls of a directory containing Java bytecode . | |
* | |
* It uses the Soot library. | |
* | |
* Usage: | |
* 1. Change the classpath and the directoryToAnalyze variable | |
* 2. run java -cp bin:soot.jar mm.soot.MethodCallCollector | |
* 3. look at /tmp/data.dat |
This file contains 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
<?php | |
/* Feeds a database with the content of a bibtex file parsed with bibtexbrowser | |
* See: http://www.monperrus.net/martin/feeding-mysql-database-with-bibtexbrowser | |
* Author: Martin Monperrus | |
* Last Modification Date: July 2013 | |
* Creation Date: Feb 2012 | |
*/ | |
// if exists, should contain define('DB_PASSWORD', 'dssizyrekzbqsf');, etc. | |
@include('conf.local.php'); |
This file contains 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
""" | |
Migrates the XML export file of js-kit/echo to the format of jskomment (http://code.google.com/p/jskomment/) | |
--Martin Monperrus | |
Tuesday, July 10 2012 | |
""" | |
import xml.dom.minidom | |
import hashlib | |
import base64 | |
import json |
This file contains 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
WebDriver webDriver = new FirefoxDriver(); | |
webDriver.navigate().to("http://example.com/some/page"); | |
LinkedHashSet<WebElement> clickableElements = new LinkedHashSet<WebElement>(); | |
clickableElements.add(webDriver.findElements(By.cssSelector("a[id*='price']")); | |
clickableElements.add(webDriver.findElements(By.cssSelector("a[class*='price']")); | |
clickableElements.add(webDriver.findElements(By.cssSelector("a[name*='price']")); | |
clickableElements.add(webDriver.findElements(By.cssSelector("a[value*='price']")); | |
clickableElements.add(webDriver.findElements(By.cssSelector("a[title*='price']")); | |
clickableElements.add(webDriver.findElements(By.cssSelector("a[alt*='price']")); | |
clickableElements.add(webDriver.findElements(By.xpath("//input[contains(@*, 'price')]")); |
This file contains 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
WebDriver webDriver = new FirefoxDriver(); | |
webDriver.navigate().to("http://example.com/some/page"); | |
// simplified: find table which contains the keyword | |
WebElement tableElement = webDriver.findElement(By.xpath("//table[contains(text(), 'Username')]")); | |
// create empty table object and iterate through all rows of the found table element | |
ArrayList<HashMap<String, WebElement>> userTable = new ArrayList<HashMap<String, WebElement>>(); | |
ArrayList<WebElement> rowElements = tableElement.findElements(By.xpath(".//tr")); |
This file contains 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
WebDriver webDriver = new FirefoxDriver(); | |
webDriver.navigate().to("http://example.com/some/page"); | |
LinkedHashSet<RemoteWebElement> clickableElements = new LinkedHashSet<RemoteWebElement>(); | |
LinkedHashSet<RemoteWebElement> belowInformationElements = new LinkedHashSet<RemoteWebElement>(); | |
LinkedHashSet<RemoteWebElement> rightToLanguageElements = new LinkedHashSet<RemoteWebElement>(); | |
LinkedHashSet<RemoteWebElement> imageElements = new LinkedHashSet<RemoteWebElement>(); | |
LinkedHashSet<RemoteWebElement> englishElements = new LinkedHashSet<RemoteWebElement>(); | |
// fetch all elements |
This file contains 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
// get desired element and save its visible text | |
WebDriver webDriver = new FirefoxDriver(); | |
webDriver.navigate().to("http://example.com/some/page"); | |
WebElement elementWithDate = webDriver.findElement(By.cssSelector("#creation-date")); | |
String text = elementWithDate.getText(); | |
Date date = null; boolean dateFound = false; | |
String year,month,monthName,day,hour,minute,second,ampm = null; | |
String regexDelimiter = "[-:\\/.,]"; |
This file contains 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 | |
# -*- coding: iso-8859-1 -*- | |
# Contains a small model-driven development toolchain for teaching purpose | |
# * a state machine metamodel | |
# * a code generator state machine -> C code | |
# * an EMf-like marshalling system based on YAML | |
# | |
# It does not use any model-driven library in order to focus on concepts | |
# and not on the accidental complexity of tools. | |
# |
OlderNewer