Skip to content

Instantly share code, notes, and snippets.

View gvanem's full-sized avatar

Gisle Vanem gvanem

View GitHub Profile
/*
* A small sample shows undefined behaviour in 'qsort()'
* when all elements *comparing on* are equal. I.e. all
* the array elements are not necessarily equal; only the one we
* care about. It seems a 'swap()' operation is performed anyway (?)
*
* Compile:
* c:\> clang -Wall -o qsort-undefined.exe qsort-undefined.c
* or
* c:\> gcc -Wall -o qsort-undefined.exe qsort-undefined.c
#
# Nmake makefile for IP2Location (MSVC)
# Ref: https://github.com/chrislim2888/IP2Location-C-Library
#
TARGET_LIB = libIP2Location/IP2Location.lib
TARGET_TEST = test/test-IP2Location.exe
CFLAGS = -nologo -DWIN32 -MD -I./libIP2Location -DPACKAGE_VERSION=\"8.0.4\"
LDFLAGS = -nologo -debug -map -incremental:no
@gvanem
gvanem / Makefile.Windows
Last active July 11, 2020 15:36
GNU-makefile for Windump
#
# tcpdump/windump Makefile for MSVC or clang-cl.
# NB! Needs GNU make 4.x.
#
# By Gisle Vanem <[email protected]> 2004 - 2019.
#
THIS_FILE = Makefile.Windows
BUILD_DATE = $(shell date +%d-%B-%Y)
PYTHON ?= py -3
@gvanem
gvanem / make-oui.py
Last active December 10, 2017 03:33
A script for tcpdump; generates a oui-generated.c from http://standards-oui.ieee.org/oui.txt and http://www.iana.org/assignments/enterprise-numbers
#!/usr/bin/env python
#
# Generates a 'oui-generated.c' for tcpdump.
#
from __future__ import print_function
import sys, os, time, re, getopt, codecs
OUI_URL = "http://standards-oui.ieee.org/oui.txt"
ENT_URL = "http://www.iana.org/assignments/enterprise-numbers"
#
# Gpredict Makefile for MinGW, MSVC and clang-cl.
# Needs GNUmake v4+.
#
# By G. Vanem <[email protected]> 2016.
#
THIS_FILE = Makefile.Windows
#
# Ideally use:
@gvanem
gvanem / curl-roffit-chm.make
Last active January 24, 2018 17:51
A GNU-makefile to generate a CURL.CHM file from all 'curl/docs/*.1' and 'curl/libcurl/*.3' files.
#
# A GNU-makefile to generate a CURL.CHM file from all
# 'curl/docs/*.1' and 'curl/libcurl/*.3' files.
#
# This makefile *must* be put in it's own directory under '<CURL_ROOT>/docs'.
# E.g. '<CURL_ROOT>/docs/Compressed-HTML'.
#
# Unless you edit the below '$(CURL_DOC_DIR)' to suite.
#
# If you're unable to build it, it's here too:
@gvanem
gvanem / Welle-IO-multiple-instances.diff
Last active January 28, 2018 11:27
A diff to enable multiple SDR-sticks in Welle-IO
diff -Hb -u3 a/src/CRadioController.cpp src/CRadioController.cpp
--- a/src/CRadioController.cpp 2018-01-25 17:15:49
+++ b/src/CRadioController.cpp 2018-01-28 11:08:21
@@ -185,6 +185,8 @@
QString dabDevice = "auto";
#endif
+ int instance = 0;
+
#ifdef HAVE_SOAPYSDR
@gvanem
gvanem / SpyServerPoll.py
Last active January 29, 2022 18:21
Python script to poll a list of AirSpy servers from the list at https://airspy.com/spy-servers/ + some more. Use as e.g: py -3 SpyServerPoll.py -c sdr://k2*
"""A Python script to poll a list of AirSpy, Kiwi and SDR-Console (V3) servers.
"""
#
# By G. Vanem <[email protected]> 2018
#
# The Gist is here:
# https://gist.github.com/gvanem/8a83e5f5dd487af4bf4e73c0f81c5393
#
# todo: OpenWebRX and WebSockets like this:
@gvanem
gvanem / Makefile.Windows
Last active February 23, 2018 12:28
GNU makefile for libusb using MSVC, MinGW or clang-cl (32-bit only). With an added "example/usb_enum.c" to print information on all USB-devices (optionally using HID-API from https://github.com/signal11/hidapi)
#
# GNU Makefile for libusb (MinGW + MSVC + clang-cl).
#
# By G. Vanem <[email protected]> 2013.
#
DATE := $(shell date +%d-%B-%Y)
VPATH = libusb libusb/os examples
THIS_FILE = Makefile.Windows
@gvanem
gvanem / Makefile.MSVC
Last active February 7, 2024 09:28
A GNU-makefile for Pycurl/MSVC (tired of 'setup.py build' problems on Windows). Put in 'src' directory of Pycurl and do 'make -f Makefile.MSVC clean install'
#
# GNU makefile 4.x for pycurl (MSVC)
#
# By <[email protected]> 2013 - 2024.
#
THIS_FILE := $(firstword $(MAKEFILE_LIST))
DATE := $(shell date +%d-%B-%Y)
YEAR := $(shell date +%Y)
VERSION := 7.45.2