Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<body>
<?php
var_export($_POST);
?>
<form method="post" name="thumbnail">
<input type="hidden" value="202" id="id_recipe" name="id_recipe">
<input type="hidden" value="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoIAAAF+CAYAAAAWSHvqAAAgAElEQVR4nLS993Mj95mv639i77GPwgTNkBxGMCcA3cg5MHOyJmmiJidOzkNODpIs2evs3XVYy/auo2xZK0fJVhh5AkGQ6G6iQZAgIZHj9Z6turduPfeHbyOQo9...(continues)...BJRU5ErkJggg==" id="effectApplied" name="effectApplied">
import subprocess
with open("blah.txt",'wb') as f:
subprocess.call(['date'], stdout=f, stderr=subprocess.STDOUT)
f.flush()
print (open("blah.txt", 'rb').read())
@phihag
phihag / fftest.py
Last active December 14, 2015 16:49
Test script for firefox webdriver in selenium
import subprocess,selenium.webdriver,os
subprocess.call(['killall', 'Xvfb'])
subprocess.Popen(['Xvfb', ':43','-ac','-screen','0','1024x768x16'])
os.environ["DISPLAY"]=":43"
ff = selenium.webdriver.Firefox()
ff.get('http://google.com/')
print(ff.title)
#!/usr/bin/env node
var WebSocketServer = require('websocket').server;
var http = require('http');
var server = http.createServer(function(request, response) {
console.log((new Date()) + ' Received request for ' + request.url);
response.writeHead(404);
response.end();
});
server.listen(8080, function() {
@phihag
phihag / not_working.selenium-log
Created December 27, 2012 16:40
selenium log when it fails to acquire socket
17:22:11.176 INFO [10] org.openqa.selenium.server.SeleniumServer - Writing debug logs to not_working.log
17:22:11.178 INFO [10] org.openqa.selenium.server.SeleniumServer - Java: Sun Microsystems Inc. 14.0-b16
17:22:11.178 INFO [10] org.openqa.selenium.server.SeleniumServer - OS: Linux 2.6.32-5-amd64 amd64
17:22:11.229 INFO [10] org.openqa.selenium.server.SeleniumServer - v2.28.0, with Core v2.28.0. Built from revision 18309
17:22:11.231 INFO [10] org.openqa.selenium.server.SeleniumServer - Selenium server running in debug mode.
17:22:11.263 DEBUG [10] org.openqa.jetty.util.Container - add component: SocketListener0@0.0.0.0:4444
17:22:11.275 DEBUG [10] org.openqa.jetty.util.Container - add component: org.openqa.jetty.http.ResourceCache@481adc30
17:22:11.281 DEBUG [10] org.openqa.jetty.util.Container - add component: org.openqa.selenium.server.ProxyHandler in HttpContext[/,/]
17:22:11.282 DEBUG [10] org.openqa.jetty.util.Container - add component: HttpContext[/,/]
17:22:11.284 DEBUG [10] org.openqa.jetty.http.H
@phihag
phihag / not_working.strace
Created December 27, 2012 16:37
strace log of selenium failing to start
2371 execve("/usr/bin/java", ["java", "-jar", "selenium-server-standalone-2.28."..., "-debug", "-log", "not_working.log"], [/* 18 vars */]) = 0
2371 brk(0) = 0xc02000
2371 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
2371 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc6ffb1c000
2371 readlink("/proc/self/exe", "/usr/lib/jvm/java-6-openjdk/jre/bin/java", 4096) = 40
2371 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
2371 open("/usr/lib/jvm/java-6-openjdk/jre/bin/../lib/amd64/jli/tls/x86_64/libz.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
2371 stat("/usr/lib/jvm/java-6-openjdk/jre/bin/../lib/amd64/jli/tls/x86_64", 0x7fff039a5ae0) = -1 ENOENT (No such file or directory)
2371 open("/usr/lib/jvm/java-6-openjdk/jre/bin/../lib/amd64/jli/tls/libz.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
2371 stat("/usr/lib/jvm/java-6-openjdk/jre/bin/../lib/amd64/jli/tls", 0x7fff03
2333 execve("/usr/bin/java", ["java", "-jar", "selenium-server-standalone-2.28."..., "-debug"], [/* 18 vars */]) = 0
2333 brk(0) = 0x1766000
2333 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
2333 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f466e2eb000
2333 readlink("/proc/self/exe", "/usr/lib/jvm/java-6-openjdk/jre/bin/java", 4096) = 40
2333 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
2333 open("/usr/lib/jvm/java-6-openjdk/jre/bin/../lib/amd64/jli/tls/x86_64/libz.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
2333 stat("/usr/lib/jvm/java-6-openjdk/jre/bin/../lib/amd64/jli/tls/x86_64", 0x7fff8c5ed200) = -1 ENOENT (No such file or directory)
2333 open("/usr/lib/jvm/java-6-openjdk/jre/bin/../lib/amd64/jli/tls/libz.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
2333 stat("/usr/lib/jvm/java-6-openjdk/jre/bin/../lib/amd64/jli/tls", 0x7fff8c5ed200) = -1 ENOENT (No su
@phihag
phihag / _jvm_intf.py
Created December 10, 2012 02:12
Sublime 2 killer
_jboolean = ctypes.c_ubyte
_jbyte = ctypes.c_ubyte
_jchar = ctypes.c_short
_jshort = ctypes.c_int16
_jint = ctypes.c_int32
_jlong = ctypes.c_int64
_jfloat = ctypes.c_float
_jdouble = ctypes.c_double
_jsize = _jint
#!/bin/sh
branch=$(echo "$1" | sed 's#refs/[^/]*/##')
repo="$GL_REPO/$branch"
mail_subject="$repo changed by $GL_USER"
oldcommit="$2"
if test "$2" = 0000000000000000000000000000000000000000; then
# New branch
oldcommit="$(git rev-parse --not --all | grep -v "$3" | git rev-list --stdin "$3" | tail -n 1)^"
fi
@phihag
phihag / so_signals.py
Created October 2, 2012 15:52
Demo that signals don't get spread
from __future__ import print_function
import signal
import subprocess
import os
import sys
import time
me = sys.argv[1] if len(sys.argv) >= 2 else 'controller'
signal.signal(signal.SIGUSR1, lambda *args: print(me + ': SIGUSR1 caught'))