Skip to content

Instantly share code, notes, and snippets.

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))
@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}
@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 / 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 / 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):
#!/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)
#!/usr/bin/env python3
from pip._vendor import packaging
from packaging.specifiers import SpecifierSet
tests_good = [
'0.99999999',
'0.999999999',
'1.0b9',
'1.0b10',
$ python3 unicode_test.py
Running test on 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118]
Running with locale encoding 'UTF-8'...
Success
$ python2 unicode_test.py
Running test on 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118]
Running with locale encoding 'UTF-8'...
@indivisible
indivisible / backbrightness.py
Created July 3, 2017 20:24
ACPI backlight to panel gamma converter for Alienware 13 R3 OLED
#!/usr/bin/env python3
# based on:
# https://gist.github.com/joel-wright/68fc3031cbb3f7cd25db1ed2fe656e60
import os
import time
from pathlib import Path
from functools import lru_cache
@indivisible
indivisible / twbt_patch_maker.py
Created December 10, 2017 22:17
TWBT patch maker for Linux version
#!/usr/bin/env python3
import hashlib
import xml.etree.ElementTree as ET
from itertools import islice
import r2pipe
def md5(path, block_size=2**20):