Skip to content

Instantly share code, notes, and snippets.

@bellbind
bellbind / getbodytext.py
Created Jun 25, 2009
[python][pywebkitgtk]rint entire HTML text after processed JavaScript
View getbodytext.py
#
# 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 Jun 26, 2009
[c][webkit][gtk]Print entire HTML text after processed JavaScript
View getbodytext.c
/*
* 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 Jun 29, 2009
[python][pywebkitgtk]Get web page screenshot
View getscreenshot.py
#
# 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 Jun 30, 2009
[c][gtk][webkit] Print entire HTML text after processed JavaScript
View getbodytext_gc.c
/*
* 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 Jul 1, 2009
[c][gtk][webkit]get screenshot PNG from web page
View getscreenshot.c
/*
* 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 Jul 1, 2009
[C][gegl][tool] convert image to PNG thumbnail
View geglthumbnail.c
/* 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 Jul 2, 2009
[C][gegl][webkitgtk][X][tool] get web site thumbnail
View getscreenshot_gegl.c
/*
* 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 Jul 2, 2009
[C][gegl][tool] show list of gegl operations
View geglops.c
/* 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 Jul 3, 2009
[python][webkitgtk][PIL][X][tool] get web site thumbnail by webkit
View webkitscreenshot.py
#!/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 Jul 9, 2009
[Python] brainf**k interpreter with no AST
View bf.py
import sys
class Engine(object):
"""Brainf**k interpreter.
usage:
bf = Engine()
bf("++++++++++++++.")
"""
def __init__(self):
self.insts = {