Skip to content

Instantly share code, notes, and snippets.

View karlcow's full-sized avatar
⛩️
Working from … anywhere

Karl Dubost karlcow

⛩️
Working from … anywhere
View GitHub Profile
@karlcow
karlcow / list.uri
Created January 27, 2014 07:23
List of social network sites extracted from wikipedia
http://43things.com
http://academia.edu
http://Advogato.org
http://ANobii.com
http://Asianave.com
http://aSmallWorld.net
http://Athlinks.com
http://Audimated.com
http://bebo.com#
http://Biip.no
(function() {
var n = this,
aa = function(a, b, e) {
return a.call.apply(a.bind, arguments)
}, ba = function(a, b, e) {
if (!a) throw Error();
if (2 < arguments.length) {
var d = Array.prototype.slice.call(arguments, 2);
return function() {
var e = Array.prototype.slice.call(arguments);
@karlcow
karlcow / error.md
Created February 10, 2021 13:50
lxml.etree.XMLSyntaxError: Char 0x0 out of allowed range

With lxml 4.5.0

❯ python
Python 3.9.1 (default, Feb  5 2021, 17:04:50) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
>>> from io import StringIO
>>> etree.parse(StringIO('<h2>👺</h2>'))
@karlcow
karlcow / stupid-copy-protection.html
Created May 22, 2014 22:27
People trying to put copy protection on their content.
<!-- WP Content Copy Protection script by Rynaldo Stoltz Starts - http://securiilock.com -->
<div align="center"><noscript>
<div style="position:fixed; top:0px; left:0px; z-index:3000; height:100%; width:100%; background-color:#FFFFFF">
<div style="font-family: Tahoma; font-size: 14px; background-color:#FFF000; padding: 10pt;">Please enable your Javascript to see this page as it is meant to appear!</div></div>
</noscript></div>
<script type="text/javascript">
window.onload = function() {
disableSelection(document.body)
@karlcow
karlcow / blogpost.md
Created September 9, 2014 05:15
emlx to mbox for MacOSX. The Web site has disappeared so Here the code. http://web.archive.org/web/20130905074537/http://brownjava.org/2007/08/emlx2mboxpy.html

A week or so ago I decided I wanted to get all of my archived mail from Mac OS X's Mail.app into a more readable format. I was a bit surprised to find that ever since 10.4, Mac OS X stores its mail in an Apple-invented format called "EMLX" (well, this is what I'm calling it at least...each mail message is stored in a file that ends in ".emlx"). A very rough sketch of the file format:

  1. The first line of the file (beginning of the document to the first linefeed) is an ASCII-encoded number representing the size of the actual email message in bytes.
  2. Starting with the first byte after the linefeed is the email, exactly N bytes in size where N is the number of bytes specified in #1.
  3. From the end of the email message to the end of the .emlx file is an XML-encoded Apple PList containing metadata about the email message (presumably for spotlight).

I really don't care for the .emlx file format. The only application that's able to read it is Mail.app. Really the only reason for its existence is because Apple w

@karlcow
karlcow / blog-comments.md
Last active August 25, 2022 17:44
Decentralized Commenting Systems or more exactly how do we interconnect blog posts.

Threading discussions in between blogs

A recurrent discussion is happening in the French Web community about comments and blogs and how to continue to publish on your own blogs and still aggregates the discussion into a thread in your own blog. So basically how the discussions can be decentralized and distributed with a notion of multiple copies.

Hashtag

Let's use #sudwebcmt for the hashtag. It will help avoid putting plenty of people in cc in the discussions.

References

@karlcow
karlcow / webmention.py
Created April 26, 2013 15:51
Prototype for a [webmention](http://webmention.org/) processor in python
#!/usr/bin/python
import cgi
import os
method = os.environ['REQUEST_METHOD']
def mimeparse(http_accept):
"Create a reduced list of mime type without quality factors"
reduced_list = []
for mime in http_accept.split(","):
@karlcow
karlcow / emlx.py
Last active July 3, 2022 09:00
Parsing emlx files on Mac OS X. Apple Proprietary Storage Format for emails.
#!/usr/bin/env python
# encoding: utf-8
"""emlx.py
Class to parse email stored with Apple proprietary emlx format
Created by Karl Dubost on 2013-03-30
Inspired by Rui Carmo — https://the.taoofmac.com/space/blog/2008/03/03/2211
MIT License"""
@karlcow
karlcow / debugger-icons.md
Last active April 21, 2022 03:56
Comparison of debuggers icons for steps debugging
#!/usr/bin/env python3
# encoding: utf-8
"""
Monitor the needsdiagnosis milestones.
Created by Karl Dubost - 2018-02-18
"""
import datetime
import json