RkBlog

Interesting stuff

  • pyffmpeg: Python API for ffmpeg that allows for example saving movie frames as images (making thumbs)
  • showdown: is a Markdown implementation in JavaScript. It can be used as a live preview or as a base of Markdown WYSIWYG editor on your Django powered site :)
  • stripegenerator.com: if you need some web 2.0 strips :nice:
  • editArea: a JavaScript based code editor with code highlighting for PHP, CSS, Javascript, Python, HTML, XML, VB, C, CPP, Pascal, Basic and Brainf*ck. Maybe a Admin Panel template editor? ToCheck on my list

› Read more

Python and chemistry

I've been doing a lot of gas chromatography tests lately (tetrachloride carbon decomposition in pulse dielectric barrier discharge) and the chromatograph (HP) makes CH1 or CDF (ANDI/netCDF Mass Spectrometry Data Interchange format) files. And for CDFs in python we have pycdf. Here is a mass chart generator:

› Read more

How to get a wikipedia (mediawiki) page content

This code will extract the content of any mediawiki wiki page:

from httplib import HTTPConnection
from re import findall, DOTALL

def wiki(slug):
	#connect to a wikipedia (mediawiki) site (Polish)
	conn = HTTPConnection("pl.wikipedia.org")
	#get page by slug
	conn.request('GET', '/wiki/'+slug)
	r = conn.getresponse()
	if str(r.status) == '200':
		#extract content
		tags = findall( r'<!-- start content -->(.*?)<!-- end content -->', r.read().decode('utf-8'), DOTALL)
		tags = tags[0].replace('href="/wiki', 'href="http://pl.wikipedia.org/wiki').replace('href="/w/', 'href="http://pl.wikipedia.org/w/')
	conn.close()
	return tags

print wiki('Linux')
Needs some error handling but you get the picture ?

› Read more

RkBlog main page Search RSS Contact