Skip to content

Instantly share code, notes, and snippets.

@AndrewPardoe
AndrewPardoe / FilterKML.js
Created December 22, 2020 01:07
FilterKML.js
/* Node.js app to filter some values from a KML file. Very specific to my scenario.
Given a KML file from https://www.google.com/maps/d/viewer?mid=1ALf0s6IwCar4juuSamKjhZuOBVoPvSfk
named SeattleBikeTag.kml, remove all bike tags contained in excludes array. Create a file called
SeattleBikeTag.new.kml. This SeattleBikeTag.new.kml file can be uploaded to a new Google Map.
*/
var fs = require('fs'),
path = require('path'),
xmlReader = require('read-xml')
@AndrewPardoe
AndrewPardoe / NoSleep.cpp
Last active May 10, 2020 00:57
Temporarily prevent Windows machine from sleeping, allows monitors to turn off
#pragma comment(lib, "Kernel32")
#include <conio.h>
#include <Windows.h>
#include <WinBase.h>
int main()
{
@AndrewPardoe
AndrewPardoe / vcvars.cmd
Last active March 8, 2018 21:51
My VCVars.cmd file to set up MSVC environment
:: vcvars.ps1 wrapper for PowerShell:
:: c:\bin\scripts\Invoke-CmdScript.ps1 c:\bin\scripts\vcvars.cmd
@echo off
if "%1" EQU "/?" echo Usage: vcvars [arch] [version] & goto :EOF
if "%1" EQU "-?" echo Usage: vcvars [arch] [version] & goto :EOF
if /I "%1" EQU "/help" echo Usage: vcvars [arch] [version] & goto :EOF
if /I "%1" EQU "-help" echo Usage: vcvars [arch] [version] & goto :EOF
@AndrewPardoe
AndrewPardoe / UserVoice.py
Last active January 10, 2022 03:48
Scrape flat list of UserVoice Ideas with links from a category's UserVoice pages
# UserVoice doesn't have a search capability that will filter on category. I only care about my category (C++) in a huge
# Visual Studio database. This script scrapes all UserVoice suggestions in my category with links into an HTML document.
# Improvements welcome from those who actually know Python--this is the first Python script I've ever needed to write.
import re
import requests
import urllib.request
from bs4 import BeautifulSoup
# Whack any Unicode characters when printing to file. Not correct, but not crashing.
@AndrewPardoe
AndrewPardoe / get_functions.pl
Created December 10, 2016 23:57
Strip functions from MSVC /FAsc that don't exist in a dumpbin /symbols
my $filename = @ARGV[0];
system ("cl /Ox /Zc:inline /EHsc /FAsc /c $filename.cpp");
system ("link /dump /symbols $filename.obj > $filename.dmp");
# Collect the function names that are in the object binary
open DMP, "<./$filename.dmp";
# Find the COFF symbol table, in case there's more in the object dump
while (<DMP>)
{
last if (index($_, "COFF SYMBOL TABLE") != -1);
@AndrewPardoe
AndrewPardoe / SwapMouseButtons.cpp
Last active May 10, 2020 00:57
Windows utility to swap mouse button orientation between right-handed mouse and left-handed mouse
/*
Simple utility to swap mouse primary mouse buttons.
Usage: no arguments -> swap buttons
l -> set primary mouse button to right button (e.g., left-hand mouse)
r -> set primary mouse button to left button (e.g., right-hand mouse)
*/
#include "windows.h"
#include <iostream>
using namespace std;