Skip to content

Instantly share code, notes, and snippets.

View gvanem's full-sized avatar

Gisle Vanem gvanem

View GitHub Profile
@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:
#
# Gpredict Makefile for MinGW, MSVC and clang-cl.
# Needs GNUmake v4+.
#
# By G. Vanem <gvanem@yahoo.no> 2016.
#
THIS_FILE = Makefile.Windows
#
# Ideally use:
@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"
@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 <gvanem@yahoo.no> 2004 - 2019.
#
THIS_FILE = Makefile.Windows
BUILD_DATE = $(shell date +%d-%B-%Y)
PYTHON ?= py -3
#
# 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
/*
* 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
@gvanem
gvanem / TESTrun.py
Last active April 4, 2025 06:52
Tcpdump test-script in Python (not any horrid Perl stuff). With colourised output. Put in tcpdump's "tests" directory.
#!/usr/bin/env python
#
# TESTrun.py; my attempt at a Python 2/3 version of the Perl-script 'TESTrun'.
# By G. Vanem <gvanem@yahho.no>
#
# Reads './TESTLIST' and by default perform all the tcpdump tests specified
# therein (test-spec="*").
# Use option '-l' to list them.
#
from __future__ import print_function
@gvanem
gvanem / Makefile.MSVC
Last active February 14, 2018 15:23
GNU-makefile for CubicSDR (MSVC): https://github.com/cjcliffe/CubicSDR.git
#
# GNU Makefile CubicSDR (MSVC).
#
THIS_FILE = Makefile.MSVC
VER_MAJOR = 0
VER_MINOR = 2
VER_PATCH = 3
VERSION = $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
@gvanem
gvanem / SnmpMgr.c
Last active December 13, 2018 19:46
Windows SNMP client with libcurl
/*****************************************************************************
* _ _ ____ _
* 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 / Jan-Olsen-MP3.py
Last active April 24, 2018 05:34
Jan Olsen Podcast/MP3 download Python script
# !/usr/bin/env python
# -*- coding: iso-8859-1 -*-
r"""
A Python script to download all MP3 files for the character Jan Olsen
in the NRK P1 radio-show Lønsj. This will download from NRK's podcast
location at:
%s (a XML-file).
unless this RSS-file doesn't exist in %s already. This should
cause all the 153 MP3 files to be downloaded into the current directory