Skip to content

Instantly share code, notes, and snippets.

bparker06 /
Created Jul 31, 2017 — forked from anonymous/
Show the AST of a translation unit with libclang and python
# inspired by
import sys
import clang.cindex
def verbose(*args, **kwargs):
'''filter predicate for show_ast: show all'''
return True
def no_system_includes(cursor, level):
'''filter predicate for show_ast: filter out verbose stuff from system include files'''
bparker06 / gist:015fa0c99665ed325ca94811b0b7fdb1
Created Sep 11, 2017 — forked from samhocevar/gist:00eec26d9e9988d080ac
Configure sshd on MSYS2 and run it as a Windows service
View gist:015fa0c99665ed325ca94811b0b7fdb1
# — configure sshd on MSYS2 and run it as a Windows service
# Please report issues and/or improvements to Sam Hocevar <>
# Prerequisites:
# — MSYS2 itself:
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
bparker06 / vector.c
Created Oct 2, 2017
Simple vector-implementation in C
View vector.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vector.h"
void vector_init(vector *v)
v->data = NULL;
v->size = 0;
bparker06 /
Created Jan 7, 2018 — forked from fracting/
Guide to use MSYS2 on Wine
Steps to use MSYS2, pacman and makepkg in Wine

Compile and Install Wine

  1. IMPORTANT Install lastest Wine-Staging. Wine Staging provides pre-build package for a couple of distributions every two weeks. However, until last update of this wiki, new wine-staging package is not ready yet, so early testers should compile wine-staging by themselves.

Install MSYS2

  1. Backup or remove your old wineprefix:
bparker06 / test.c
Created Jan 7, 2018 — forked from nad2000/test.c
Basic examples to show how to embed and extend Python in C including: creation of module in C with functions handling and building Python objects; importing and calling python functions from C.
View test.c
/* Example of embedding Python in another program */
// to compile run:
// gcc -o test $(python-config --cflags) test.c $(python-config --ldflags) && ./test
#include "Python.h"
void initxyzzy(void); /* Forward */
main(int argc, char **argv)
bparker06 / lfsr.c
Created Feb 9, 2018 — forked from rcc/lfsr.c
C LFSR Library
View lfsr.c
* lfsr.c - lfsr library
* Copyright (C) 2009 Robert C. Curtis
* lfsr.c is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
bparker06 / gmake-patsubst.c
Created Apr 4, 2018 — forked from gromnitsky/gmake-patsubst.c
An extract of patsubst function from GNU Make
View gmake-patsubst.c
An extract of patsubst function from GNU Make 4.2.90
$ cc gmake-patsubst.c -o gmake-patsubst
$ ./gmake-patsubst %.c %.o 'foo.c bar.c'
foo.o bar.o
#include <stdio.h>
bparker06 / microsoft.txt
Created Apr 26, 2018 — forked from CHEF-KOCH/microsoft.txt
Microsoft Products + file check
View microsoft.txt
Nr. + product name + .exe/.iso/dvd + file integrety check
1 MS-DOS 6.0 (English) EN_MSDOS60.exe 2000-10-12 877B0B8E391ED07CB83214CB09E8F3B10C4B206F
2 SQL Server 2008 Enterprise (x86, x64, ia64) - DVD (Chinese-Simplified) zh-hans_sql_server_2008_enterprise_x86_x64_ia64_dvd_x14-89199.iso 2008-8-13 D23B103331AB0B3CCC82769B99CA1C2F16BEBBF4
3 Windows XP Professional with Service Pack 2- VL (Simplified Chinese) sc_win_xp_pro_with_sp2_vl.iso 2005-5-18 C0ADDD927B5D1F93DCE9C455FD6B26EAC7391BE9
4 MS-DOS 6.22 (English) EN_MSDOS622.exe 2000-10-12 D01AA47A5D85908185F8987E972AFC66DC92A735
bparker06 / memcpy.c
Created May 30, 2018 — forked from nicky-zs/memcpy.c
One way to solve the glibc compatibility problem. In my case, when building a program with libthrift.a on linux with glibc version 2.15, ld always links memcpy@GLIBC_2.14 which cannot be found on systems with glibc version < 2.14. So, use this file to define a symbol __wrap_memcpy and use -Wl,--wrap=memcpy to tell ld using this symbol when meeti…
View memcpy.c
#include <string.h>
void *__memcpy_glibc_2_2_5(void *, const void *, size_t);
asm(".symver __memcpy_glibc_2_2_5, memcpy@GLIBC_2.2.5");
void *__wrap_memcpy(void *dest, const void *src, size_t n)
return __memcpy_glibc_2_2_5(dest, src, n);
bparker06 / to_string
Created Jul 10, 2018 — forked from shanehsu/to_string
C++ to_string alternative
View to_string
#include <sstream>
template <typename T>
std::string to_string(const T& value) {
std::stringstream ss;
ss << value;
return ss.str();
int i = 0;
You can’t perform that action at this time.