Skip to content

Instantly share code, notes, and snippets.

View gvanem's full-sized avatar

Gisle Vanem gvanem

View GitHub Profile
@gvanem
gvanem / test-MMDB.c
Last active November 6, 2020 10:49
A small test program for MaxMind's MMDB-datafiles.
#include <string.h>
#include <time.h>
#include <maxminddb.h>
static MMDB_s g_mmdb = { 0 };
#define MAX_wchar_COUNTRY_NAME 50
typedef wchar_t mmdb_wname [MAX_wchar_COUNTRY_NAME];
@gvanem
gvanem / Makefile.Windows
Last active September 23, 2020 19:19
MicroPython. GNU-makefile and a 'lib_main.c' for MSVC or clang-cl.
#
# Gnu Makefile for MicroPython (MSVC or clang-cl).
#
# This Makefile MUST be placed in the root-directory of your MicroPython installation.
#
# By G. Vanem <gvanem@yahoo.no> 2020.
#
THIS_FILE = Makefile.Windows
TODAY = $(shell date +%d-%B-%Y)
@gvanem
gvanem / Asan-test.c
Created July 26, 2020 09:15
Test the new ASAN feature of MSVC
/*
* Test the new ASAN feature of MSVC (ripped from clang presumably).
*
* Ref:
* https://devblogs.microsoft.com/cppblog/addresssanitizer-asan-for-windows-with-msvc/
*/
#include <stdlib.h>
/*
* Ref 'https://github.com/google/sanitizers/wiki/AddressSanitizerFlags'
--- a/libfilezilla/lib/util.cpp 2020-07-01 12:30:29
+++ b/libfilezilla/lib/util.cpp 2020-07-04 15:32:17
@@ -125,8 +125,22 @@
uint64_t bitscan(uint64_t v)
{
-#if !FZ_WINDOWS || defined(__MINGW32__) || defined(__MINGW64__)
+#if !FZ_WINDOWS || defined(__MINGW32__) || defined(__MINGW64__) || defined(__clang__)
return __builtin_ctzll(v);
+#elif defined(_M_IX86)
@gvanem
gvanem / Makefile.Windows
Last active March 15, 2020 21:03
GNU makefile for MPIR targeting MinGW + MSVC + clang-cl. Ref: https://github.com/BrianGladman/mpir.git
#
# MPIR Makefile for MinGW + MSVC + clang-cl.
#
# by G. Vanem <gvanem@yahoo.no> 2004-2020.
#
comma := ,
DATE = $(shell date +%d-%B-%Y)
VER_MAJOR := $(shell grep -m1 __GNU_MP_VERSION gmp-h.in | cut -d' ' -f3)
VER_MINOR := $(shell grep -m1 __GNU_MP_VERSION_MINOR gmp-h.in | cut -d' ' -f3)
@gvanem
gvanem / Makefile.Windows
Last active March 2, 2024 14:29
Python 3.x Makefile for MSVC and clang-cl (x86/x64)
#
# GNU-Makefile for Python 3.x.
#
# Targeting Windows 32 + 64-bits using MSVC-201x or clang-cl.
#
# By G. Vanem <gvanem@yahoo.no> 2015 - 2022.
#
THIS_FILE = Makefile.Windows
DATE := $(shell date +%d-%B-%Y)
@gvanem
gvanem / Makefile.MSVC
Last active November 28, 2019 14:13
A Gnu-Makefile for Doxygen (targeting MSVC or clang-cl)
#
# GNU-makefile for Doxygen (MSVC / clang-cl, 32-bit)
#
# By G. Vanem <gvanem@yahoo.no> 2019.
#
THIS_FILE := Makefile.MSVC
DEP_FILE := .depend.MSVC
DATE := $(shell date +%d-%B-%Y)
#
@gvanem
gvanem / snmpmgr.c
Created August 20, 2019 16:17
A simple SNMP-manager using libcurl (Win32 only).
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
@gvanem
gvanem / EveryThing.diff
Created January 18, 2019 07:25
My private patches for the EveryThing SDK. Ref. http://www.voidtools.com
--- a/EveryThing-SDK/src/Everything.c 2017-09-02 00:00:44
+++ b/EveryThing-SDK/src/Everything.c 2019-01-18 06:30:34
@@ -28,14 +28,80 @@
// this project builds the dll (visual studio will also build the lib for us)
// we declare all exported calls to __stdcall, so theres no need to set the default calling standard.
-// disable warnings
-#pragma warning(disable : 4996) // deprecation
+/*
+ * With changes by G. Vanem <2017> for the envtool program.
@gvanem
gvanem / Makefile.Windows
Last active December 13, 2018 21:58
GNU Makefile for RTL_433 (MinGW / MSVC / clang-cl). Ref: https://github.com/merbanan/rtl_433
#
# GNU Makefile for RTL_433 (MinGW / MSVC / clang-cl).
#
# By G. Vanem <gvanem@yahoo.no> 2017.
#
# Ref: https://github.com/merbanan/rtl_433
#
# Choose your weapons:
#
# Set 'USE_STATIC_RTLSDR=1' to link with a static rtlsdr.lib.