Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import html5lib
def test_parse_serialize(html, tree_type):
walker = html5lib.getTreeWalker(tree_type)
serializer = html5lib.serializer.HTMLSerializer()
#root = html5lib.parseFragment(html, namespaceHTMLElements=False, treebuilder=tree_type)
root = html5lib.parseFragment(html, treebuilder=tree_type)
stream = walker(root)
@indivisible
indivisible / html5lib_serializer_bug.py
Created May 2, 2017 16:24
html5lib.serializer.HTMLSerializer bug
#!/usr/bin/env python3
import html5lib
from html5lib.filters.base import Filter as BaseFilter
class LogFilter(BaseFilter):
'''Print tokens passing through. Useful for debugging filters.'''
def __iter__(self):
for token in BaseFilter.__iter__(self):
@indivisible
indivisible / decompress_dds.py
Created April 10, 2017 16:33
Creates dense montages.
#!/usr/bin/env python3
import os
import os.path
import brotli
from pathlib import Path
def decompress_file(ref_root, in_stream, out_stream):
data = in_stream.read()
if data.startswith(b'DDS'):
@indivisible
indivisible / gnutls-debian-fix.patch
Created August 3, 2014 07:48
fix for the gnutls package in lachs0r's mingw build system
diff --git a/packages/gnutls.cmake b/packages/gnutls.cmake
index 35788ec..43b014e 100644
--- a/packages/gnutls.cmake
+++ b/packages/gnutls.cmake
@@ -15,7 +15,9 @@ ExternalProject_Add(gnutls
--without-p11-kit
--with-included-libtasn1
--enable-threads=win32
+ --enable-local-libopts
BUILD_COMMAND ${MAKE}
@indivisible
indivisible / gist:1fdc70aaf651c9022f5c
Created August 3, 2014 07:42
fix for lachs0r's mingw build on gcc 4.9.1
diff --git a/toolchain/CMakeLists.txt b/toolchain/CMakeLists.txt
index 336edbe..69666fe 100644
--- a/toolchain/CMakeLists.txt
+++ b/toolchain/CMakeLists.txt
@@ -8,6 +8,7 @@ ExternalProject_Add(binutils
--disable-multilib
--disable-nls
--disable-shared
+ --disable-werror
BUILD_COMMAND make -j${MAKEJOBS}
diff --git a/src/x86/ffi.c b/src/x86/ffi.c
index a02a8a1..08daf52 100644
--- a/src/x86/ffi.c
+++ b/src/x86/ffi.c
@@ -317,7 +317,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
cif->bytes += 4 * sizeof(ffi_arg);
#endif
-#ifndef X86_WIN32
+#if !(defined(X86_WIN32) || defined(X86_WIN64))