Skip to content

Instantly share code, notes, and snippets.

View elieux's full-sized avatar

David Macek elieux

View GitHub Profile
@elieux
elieux / gist:fd63e62fda6a05778004
Created May 5, 2015 23:29
SCons MSYS2/mingw platform patch
--- /usr/lib/python2.7/site-packages/SCons/Platform/msys.py.orig 2014-11-04 23:23:28.000000000 +0100
+++ /usr/lib/python2.7/site-packages/SCons/Platform/msys.py 2015-05-06 01:27:32.333448600 +0200
@@ -39,6 +39,12 @@
posix.generate(env)
env['ENV']['PATH'] = os.getenv('PATH')
+ import_env = [ 'SystemDrive', 'SystemRoot', 'TEMP', 'TMP' ]
+ for var in import_env:
+ v = os.environ.get(var)
+ if v:
@elieux
elieux / pyconfig.h-i686-x86_64.patch
Created April 23, 2015 11:13
DIfference between Python headers, 32-bit vs. 64-bit
--- a/pyconfig.h 2015-03-13 13:11:55.000000000 +0100
+++ b/pyconfig.h 2015-03-13 13:00:15.000000000 +0100
@@ -309,14 +309,14 @@
#define HAVE_GAMMA 1
/* Define if we can use x64 gcc inline assembler */
-/* #undef HAVE_GCC_ASM_FOR_X64 */
+#define HAVE_GCC_ASM_FOR_X64 1
/* Define if we can use gcc inline assembler to get and set x87 control word
@elieux
elieux / msys2-mirror.sh
Last active April 2, 2017 14:45
MSYS2 pacman repos mirroring script
#!/usr/bin/bash
ROOT="$(pwd)"
dl() {
local cookie="/tmp/pacman-mirror-cookie.txt"
touch "${cookie}"
local file
@elieux
elieux / command
Last active August 29, 2015 14:17
strace hang
echo 'echo $1 `(set -o) > /dev/null`' > hanger
for i in $(seq 1000); do strace -o ./log sh ./hanger $i; done
@elieux
elieux / scitelua.patch
Created March 21, 2015 02:57
SciTE patches for Lua 5.1.4
diff -Naurwp dist/lauxlib.c scite/lauxlib.c
--- dist/lauxlib.c 2015-03-21 03:38:03.865288100 +0100
+++ scite/lauxlib.c 2013-01-17 02:17:02.000000000 +0100
@@ -646,7 +646,7 @@ static int panic (lua_State *L) {
LUALIB_API lua_State *luaL_newstate (void) {
lua_State *L = lua_newstate(l_alloc, NULL);
- if (L) lua_atpanic(L, &panic);
+ if (L) lua_atpanic(L, panic);
return L;
@elieux
elieux / bad.c
Created March 13, 2015 15:00
GCC nested varargs error
#include <stdio.h>
#include <stdarg.h>
int sum(int count, ...) {
int result = 0;
va_list args;
va_start(args, count);
while (count--) {
result += va_arg(args, int);
}
@elieux
elieux / make.sh
Last active April 2, 2017 14:46
Debugging makefiles
#/usr/bin/sh
#http://www.drdobbs.com/tools/debugging-makefiles/197003338
make --eval='print-%: ; @echo $* is $($*)' --eval='OLD_SHELL := $(SHELL)' --eval='SHELL = $(warning [$@ ($^) ($?)])$(OLD_SHELL) -x'
make V=1 VERBOSE=1
make --dry-run
@elieux
elieux / build.log
Created March 12, 2015 21:53
mingw-w64 headers error
D:/msys64/mingw64/x86_64-w64-mingw32/include/comutil.h: At global scope:
D:/msys64/mingw64/x86_64-w64-mingw32/include/comutil.h:246:29: error: declaration of 'WCHAR* _bstr_t::Detach()' has a different exception specifier
inline BSTR _bstr_t::Detach() {
^
In file included from D:/msys64/mingw64/x86_64-w64-mingw32/include/comdef.h:19:0,
from W:/temporary/development/mingw-packages/mingw-w64-far-svn/src/far-netbox/libs/atlmfc/src\mfc\afxglobals.cpp:12,
from W:/temporary/development/mingw-packages/mingw-w64-far-svn/src/far-netbox/libs/atlmfc/mfc1.cpp:6:
D:/msys64/mingw64/x86_64-w64-mingw32/include/comutil.h:91:8: error: from previous declaration 'WCHAR* _bstr_t::Detach() throw ()'
BSTR Detach() throw();
^
@elieux
elieux / segfault.c
Created March 7, 2015 14:20
Instant crash
typedef int(*fn)();
int main() {
return ((fn)0)();
}
@elieux
elieux / gdb-check.log
Created March 6, 2015 19:55
GDB testsuite fail
make[1]: Entering directory 'srcdir/gdb-7.8.1'
make[2]: Entering directory 'srcdir/gdb-7.8.1/bfd'
make check-recursive
make[2]: Entering directory 'srcdir/gdb-7.8.1/opcodes'
make[2]: Entering directory 'srcdir/gdb-7.8.1/etc'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory 'srcdir/gdb-7.8.1/etc'
Making check in .
make[3]: Entering directory 'srcdir/gdb-7.8.1/bfd'
make[3]: Entering directory 'srcdir/gdb-7.8.1/opcodes'