Skip to content

Instantly share code, notes, and snippets.

View vadz's full-sized avatar

VZ vadz

View GitHub Profile
@vadz
vadz / winloc.cpp
Created June 10, 2021 18:34
Show value of some, or all, MSW locale settings
#define UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <strsafe.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
struct LocaleOption
@vadz
vadz / metrics.md
Last active March 28, 2021 12:31
Some MSW System Metrics
Metric Win 7 Win 10 Win 10 125% Win 10 150% Win 10 175% Win 10 200%
SM_CXBORDER 1 1 1 1 1 1
SM_CXHTHUMB 17 17 21 26 30 34
SM_CXHSCROLL 17 17 21 26 30 34
SM_CXICONSPACING 75 75 94 113 131 150
SM_CXEDGE 2 2 2 2 2 2
SM_CXMENUCHECK 15 15 19 25 29 31
SM_CXFOCUSBORDER 1 1 1 1 1 1
SM_CXPADDEDBORDER 1 4 5 6 7 8
@vadz
vadz / wx-stats.sh
Created April 18, 2020 23:04
Get CSV stats for wx release downloads
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 <x.y.z>" >&2
exit 1
fi
ver=$1
stats_file=download_stats-`date +%Y%m%d`.csv
@vadz
vadz / python_optional.i
Created March 4, 2019 13:46
Python typemaps for OptionalValue
%define DEFINE_OPTIONAL_SIMPLE(OptT, T)
// Use reference, not pointer, typemaps for member variables of this type.
%naturalvar OptionalValue< T >;
// Even though this type is not mentioned anywhere, we must still do this to
// tell SWIG to actually export this type.
%template(OptT) OptionalValue< T >;
// This typemap is used for function arguments and for setting member fields of
@vadz
vadz / java_optional.i
Created March 4, 2019 13:45
Java typemaps for OptionalValue
%define DEFINE_OPTIONAL_SIMPLE(OptT, T)
// Use reference, not pointer, typemaps for member variables of this type.
%naturalvar OptionalValue< T >;
%template(OptT) OptionalValue< T >;
// Note the use of "jboxtype" instead of just "jstype": for primitive types,
// such as "double", they're different and we must use the former as
// Optional<> can only be used with reference types in Java.
@vadz
vadz / csharp_optional.i
Last active March 4, 2019 13:47
C# typemaps for OptionalValue
// The macro arguments for all these macros are the name of the exported class
// and the C++ type T of OptionalValue<T> to generate the typemaps for.
// Common part of the macros below, shouldn't be used directly.
%define DEFINE_OPTIONAL_HELPER(OptT, T)
// The OptionalValue<> specializations themselves are only going to be used
// inside our own code, the user will deal with either T? or T, depending on
// whether T is a value or a reference type, so make them private to our own
// assembly.
@vadz
vadz / optional.i
Created March 4, 2019 13:39
Main optional.i file
%{
#include "optionalvalue.h"
%}
// Provide simplified declarations of various template classes we use for SWIG.
template <typename T>
class OptionalValue
{
public:
OptionalValue();
@vadz
vadz / gtkdpi.cpp
Created October 29, 2018 17:51
Show display sizes and DPI using various GTK+ functions
// Compile using the following command
//
// g++ -Wall -Wno-deprecated-declarations gtkdpi.cpp `pkg-config --cflags --libs gtk+-3.0`
//
// And then run ./a.out
#include <gtk/gtk.h>
static void
print_sizes_and_dpi(int w, int h, int wmm, int hmm)
{
Cloning into '.'...
10.80s user 2.47s system 1% cpu 13:00.52 total
ATTENTION: no --prefix supplied, building and installing to /tmp/tmp.o2BIF8otPY/install
No pre-existing installed file found at /tmp/tmp.o2BIF8otPY/install/bin/nqp-m
Cloning into 'nqp'...
Note: checking out '2017.09-119-g4494e7049'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
@vadz
vadz / lmi_style.md
Created March 6, 2017 14:57
Draft of lmi style guide

Coding Style Guidelines for lmi

Files

This section covers organization of the source code in files.

Don't use subdirectories