Skip to content

Instantly share code, notes, and snippets.

View pavel-a's full-sized avatar

Pavel A. pavel-a

View GitHub Profile
@pavel-a
pavel-a / wifi_scan.m
Created March 12, 2015 12:02
Wi-Fi scan for Apple OS X (maybe works for iOS too)
/* The official example for CoreWLAN is now obsolete,
so here's a small command-line example that works with Xcode 6 and Yosemite.
It only demonstrates how to get basic wi-fi connection properties and scan.
Enjoy!
pavel_a@fastmail.fm 01-Mar-2015
*/
#import <Foundation/Foundation.h>
#import <CoreWLAN/CoreWLAN.h>
#include <stdio.h>
@pavel-a
pavel-a / build_box_wdk.cmd
Last active May 8, 2022 14:44
Set of scripts for building Windows Driver Kit projects (pre-Win8 WDKs)
:: Replacement for WDK build env shortcuts
:: Opens interactive cmd box for WDK build.
:: This is *not* intended to run build from Visual Studio!
:: Rev.b 08-may-2009 pavel_a@fastmail.fm -- for WDK 7600 (7.1.0) or 6xxx
@echo off
@IF NOT CMDEXTVERSION 2 EXIT
set BASEDIR=%~dp0
: *** SET BASEDIR TO YOUR WDK PATH if this file is not there ***
@pavel-a
pavel-a / autorun.inf
Created September 17, 2015 01:14
Autorun.inf file for USB drives . Shows custom label in Windows explorer (some Linuxes too)
[AutoRun]
label=RETURN TO ME!
[IgnoreContentPaths]
*
@pavel-a
pavel-a / targetver.h
Last active December 8, 2020 04:57
Writable code section fixer
#pragma once
#define _WIN32_WINNT NTDDI_WINXP
#include <SDKDDKVer.h>
@pavel-a
pavel-a / README.md
Last active March 17, 2020 05:53
Small utility to detect when a VC++ program cannot start because runtime libs or some other DLL is missing.

Launcher-vc

This is a small utility to detect when a program cannot start because VC++ runtime or .NET, or some DLL is missing. It can be useful for verifying automated builds or deployment.

No popups like "Application error... The application failed to initialize properly..." should be displayed. If the app cannot initialize, there will be a plain message printed saying so, and errorlevel will be set.

@pavel-a
pavel-a / dbg_preprocessor.README
Last active June 24, 2024 22:42
Preprocessor that converts C printf-like statements to something like Linux bprintf and extracts format strings. Can be used in small embedded systems to save memory and processing time on target.
This is a preprocessor that converts C printf-like statements in C code to something like Linux bprintf and extracts format strings.
It can be used in small embedded systems to save memory and processing time on target.
The following describes our custom implementation for a 32-bit LE machine (Tensilica Xtensa CPU & xcc toolchain). One can tweak it as needed.
Limitations:
* Limitation of the parser: ...... see in the py file
* Limitation of codegen: ....... ditto.
Mainly, all arguments must be scalar.
Format %s is supported only for constant strings (string literals, __func__ or __FUNCTION__)
@pavel-a
pavel-a / KbdRuPh3.klc
Last active August 10, 2017 14:11
Keyboard Layout - Russian Translit For Windows, MAC OS X
KBD KbdRuPh "Russian Phonetic Smile v1 (Linux style)"
COPYRIGHT "(c) 2006-2008 pavel_a@live.com"
COMPANY "pavel_a@live.com"
LOCALENAME "ru-RU"
LOCALEID "00000419"
@pavel-a
pavel-a / winKdPrintUm.h
Created April 10, 2018 21:08
Print to the Windows kernel debugger from usermode
////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Print to kernel debugger from user mode
///
/// Usage:
///
/// ULONG getKdPrintPointers(void);
/// int isKdPrintAvailable(void);
///
/// ULONG KdPrintEx((ULONG ComponentId, ULONG Level, PCHAR Format, ...));
/// ULONG KdPrintExWithPrefix((PCHAR prefix, ULONG ComponentId, ULONG Level, PCHAR Format, ...));
@pavel-a
pavel-a / chkspaces.bat
Created May 20, 2018 23:47
Windows path sanitize (de-space, shorten)
: Pass path to sanitize as arg 1
@echo off
echo Original path=[%~1]
call :chkspaces "%~1"
if /I NOT "%_sp%" == "%~1" call :shrt "%~1"
echo uglified=[%_sp%]
goto :EOF
:chkspaces
// Detect the proper COM ports for paired BT devices by name prefix
// pavel_a@fastmail.fm 12-feb-2019
#include "pch.h"
#define _CRT_SECURE_NO_WARNINGS 1
#include <vector>
#include <tuple>
#include <string>
#include <process.h>
#include <iostream>