Skip to content

Instantly share code, notes, and snippets.

View daluu's full-sized avatar

David Luu daluu

View GitHub Profile
@santiycr
santiycr / TestingUploadSe2Sauce.java
Created December 22, 2011 04:44
Remote File Upload using Selenium 2's FileDetectors
import junit.framework.Assert;
import junit.framework.TestCase;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.*;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class TestingUploadSe2Sauce extends TestCase {
private RemoteWebDriver driver;
@mmadson
mmadson / App.gwt.xml
Created December 22, 2011 18:41
Selenium test for GWT FileUpload, e.g., how to specify a file path using Selenium for <input type="file"...>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN"
"http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="App">
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name="com.google.gwt.place.Place"/>
<inherits name="com.google.gwt.activity.Activity"/>
<inherits name="com.google.gwt.logging.Logging"/>
<inherits name="com.google.gwt.http.HTTP" />
@ssokolow
ssokolow / png2pdf.py
Created December 26, 2011 16:07
Simple script for converting a set of PNGs into a PDF
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A simple tool for converting batches of PNG pages into a PDF file.
Usage:
1. Drop into the folder with the PNGs.
2. chmod +x png2pdf.py
3. Double-click it.
Requires:
@btoews
btoews / foo.sh
Created December 28, 2011 17:12
tcpdump command injection trick
#!/bin/sh
#a good way of testing to see if you can get command injection
#on a remote web application is to have tcpdump listen for icmp
#packets and then trying to inject the "ping -c 10 yourip.com"
#into the vulnerable server. You should see your server's terminal
#light up with incoming ICMP packets...
tcpdump -i eth0 ip proto \\icmp -v
#similar trick for HTTP... this has other applications
@robertjd
robertjd / gist:1573310
Created January 7, 2012 00:59
Websocket Handshake without Upgrade header
hybi-07-12, headers: { host: 'example.com',
'sec-websocket-key': 'jjtFcDA0FonXscXj25UuaQ==',
'sec-websocket-origin': 'ws://example.com/socket.io/1/websocket/1105054216814116754',
'sec-websocket-version': '8',
'sec-websocket-protocol': '8',
'cache-control': 'max-stale=0',
connection: 'Keep-Alive',
'x-bluecoat-via': 'DDBD0991AB5F8902' }
@rutger1140
rutger1140 / fauxconsole.js
Created January 11, 2012 09:58
Faux Console for IE, by Chris Heilmann
/* Faux Console by Chris Heilmann http://wait-till-i.com */
if (!window.console) {
var console = {init: function() {
console.d = document.createElement('div');
document.body.appendChild(console.d);
var a = document.createElement('a');
a.href = 'javascript:console.hide()';
a.innerHTML = 'close';
console.d.appendChild(a);
@krmahadevan
krmahadevan / GridInfoExtracter.java
Created February 8, 2012 08:25
A utility class that extracts the actual IP and port to which your remote executions are being routed to by Grid2
public class GridInfoExtracter{
private static String[] getHostNameAndPort(String hostName, int port,
SessionId session) {
String[] hostAndPort = new String[2];
String errorMsg = "Failed to acquire remote webdriver node and port info. Root cause: ";
try {
HttpHost host = new HttpHost(hostName, port);
DefaultHttpClient client = new DefaultHttpClient();
@mbostock
mbostock / .block
Last active June 1, 2021 21:40
Histogram Chart
license: gpl-3.0
@sr75
sr75 / run-ie-7-8-9-virtualbox-on-osx.txt
Created March 15, 2012 13:52
Run IE 7, 8, and 9 in Mac OS X
# the admin password for all of the IE VMs is “Password1″ without the quotes, it's also used for the password hints
1) Install VirtuaBox on your mac
http://download.virtualbox.org/virtualbox/4.1.10/VirtualBox-4.1.10-76795-OSX.dmg
2) Decide which versions of Internet Explorer you want to download and install – each version of Internet Explorer is contained within a separate virtual machine that runs within VirtualBox. In other words, if you want to run Internet Explorer 7, 8, and 9, you will need to download three separate VM’s, which may take a while so keep that in mind. Select the text below and copy it:
# Install ALL versions of Internet Explorer: IE 7, IE 8, and IE 9 (for now this script will also pull down a IE 6 vm with windows xp)
@moraes
moraes / gist:2141121
Last active January 30, 2025 10:45
LIFO Stack and FIFO Queue in golang
package main
import (
"fmt"
)
type Node struct {
Value int
}