Skip to content

Instantly share code, notes, and snippets.

@bellbind
bellbind / getbodytext.py
Created June 25, 2009 13:51
[python][pywebkitgtk]rint entire HTML text after processed JavaScript
#
# Print entire HTML text after processed JavaScript
#
# usage:
# /usr/bin/xvfb-run python getbodytext.py test.html
#
# libs:
# - pygtk: http://www.pygtk.org/
# - pywebkitgtk(python-webkit): http://code.google.com/p/pywebkitgtk/
# - jswebkit: http://code.google.com/p/pywebkitgtk/issues/detail?id=28#c9
@bellbind
bellbind / getbodytext.c
Created June 26, 2009 14:35
[c][webkit][gtk]Print entire HTML text after processed JavaScript
/*
* Print entire HTML text after processed JavaScript
*
* build:
* FLAGS=`pkg-config --cflags --libs gtk+-x11-2.0 glib-2.0 webkit-1.0`
* gcc -Wall $FLAGS getbodytext.c -o getbodytext
*
* usage:
* /usr/bin/xvfb-run ./getbodytext test.html
*
@bellbind
bellbind / getscreenshot.py
Created June 29, 2009 15:50
[python][pywebkitgtk]Get web page screenshot
#
# Get web page screenshot
#
# usage:
# xvfb-run -s "-screen 0 1024x768x24" python getschreenshot.py test.html
#
# libs:
# - pygtk: http://www.pygtk.org/
# - pywebkitgtk(python-webkit): http://code.google.com/p/pywebkitgtk/
# - PIL: http://www.pythonware.com/products/pil/
@bellbind
bellbind / getbodytext_gc.c
Created June 30, 2009 11:33
[c][gtk][webkit] Print entire HTML text after processed JavaScript
/*
* Print entire HTML text after processed JavaScript
*
* build:
* FLAGS=`pkg-config --cflags --libs gtk+-x11-2.0 glib-2.0 webkit-1.0`
* gcc -Wall $FLAGS -lgc getbodytext_gc.c -o getbodytext_gc
*
* usage:
* /usr/bin/xvfb-run ./getbodytext test.html
*
@bellbind
bellbind / getscreenshot.c
Created July 1, 2009 13:33
[c][gtk][webkit]get screenshot PNG from web page
/*
* get screenshot PNG from web page
*
* build:
* FLAGS=`pkg-config --cflags --libs gtk+-x11-2.0 glib-2.0 webkit-1.0`
* gcc -Wall $FLAGS getscreenshot.c -o getscreenshot
*
* usage:
* /usr/bin/xvfb-run -s "-screen 0 1024x768x24" ./getscreenshot test.html
*
@bellbind
bellbind / geglthumbnail.c
Created July 1, 2009 14:28
[C][gegl][tool] convert image to PNG thumbnail
/* make PNG thumbnail by gegl: http://gegl.org/
*
* build:
* gcc -Wall `pkg-config --cflags --libs gegl` geglthumbnail.c -o geglthumbnail
*
* usage:
* ./geglthumbnail image.xxx thumbnail.png
*
*/
#include <glib.h>
@bellbind
bellbind / getscreenshot_gegl.c
Created July 2, 2009 13:20
[C][gegl][webkitgtk][X][tool] get web site thumbnail
/*
* get screenshot PNG from web page
*
* build:
* FLAGS=`pkg-config --cflags --libs gtk+-x11-2.0 webkit-1.0 gegl`
* gcc -Wall $FLAGS getscreenshot_gegl.c -o getscreenshot_gegl
*
* usage:
* xvfb-run -s "-screen 0 1024x768x24" ./getscreenshot_gegl test.html
*
@bellbind
bellbind / geglops.c
Created July 2, 2009 15:58
[C][gegl][tool] show list of gegl operations
/* list operations by gegl: http://gegl.org/
*
* build:
* gcc -Wall `pkg-config --cflags --libs gegl` geglops.c -o geglops
*
* usage:
* ./geglops
*/
#include <glib.h>
#include <glib-object.h>
@bellbind
bellbind / webkitscreenshot.py
Created July 3, 2009 13:52
[python][webkitgtk][PIL][X][tool] get web site thumbnail by webkit
#!/usr/bin/env python
"""
web page screenshot by webkit
command usage:
python webkitscreenshot.py test.html
library usage:
import webkitscreenshot
image = webkitscreenshot.screenshot_vfb("file://test.html")
@bellbind
bellbind / bf.py
Created July 9, 2009 11:51
[Python] brainf**k interpreter with no AST
import sys
class Engine(object):
"""Brainf**k interpreter.
usage:
bf = Engine()
bf("++++++++++++++.")
"""
def __init__(self):
self.insts = {