Skip to content

Instantly share code, notes, and snippets.

@wildmichael
wildmichael / ConvertXmlSpreadsheetToTable.pqm
Last active May 28, 2021 09:46
Power Query function to convert a Excel XML Spreadsheet to a table
(fileContents) => let
Source = Xml.Tables(fileContents),
Table = Source{2}[Table]{0}[Table],
#"Expanded Table" = Table.ExpandTableColumn(Table, "Table", {"Cell"}, {"Table.Cell"}),
#"Added Index" = Table.AddIndexColumn(#"Expanded Table", "Index", 0, 1),
#"Expanded Table.Cell" = Table.ExpandTableColumn(#"Added Index", "Table.Cell", {"Data"}, {"Data"}),
#"Expanded Data" = Table.ExpandTableColumn(#"Expanded Table.Cell", "Data", {"Element:Text"}, {"Element:Text"}),
#"Grouped Rows" = Table.Group(#"Expanded Data", {"Index"}, {{"Count", each Table.AddIndexColumn(_, "Cum",1,1), type table}}),
#"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Cum", "Element:Text"}, {"Cum", "Element:Text"}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Expanded Count", {{"Cum", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Expanded Count", {{"Cum", type text}}, "en-US")[Cum]), "Cum", "Element:Text"),
@wildmichael
wildmichael / EnableStore.ps1
Created August 8, 2020 19:45
Temporarily enable Windows Store
# enable windows store again overriding group policy
# TODO does not work properly...
reg add HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /v DoNotConnectToWindowsUpdateInternetLocations /d 0 /t REG_DWORD /f
reg add HKLM\SOFTWARE\Policies\Microsoft\WindowsStore /v RemoveWindowsStore /d 0 /t REG_DWORD /f
reg add HKLM\SOFTWARE\Policies\Microsoft\WindowsStore /v RequirePrivateStoreOnly /d 0 /t REG_DWORD /f
@wildmichael
wildmichael / bs4_tree_construct.py
Created January 31, 2018 19:28
Small utility to easily create a document tree with BeautifulSoup4
from bs4 import BeautifulSoup, Tag
class Attribute(object):
def __init__(self, attrname, attrvalue):
'Initializes a new attribute.'
self._attrname = attrname
self._attrvalue = attrvalue
@property
def name(self):
// ==UserScript==
// @name xkcd display alt text
// @namespace http://www.xkcd.com/themiwi
// @include https://xkcd.com/*
// @version 1
// @grant none
// @require https://code.jquery.com/jquery-3.2.1.slim.min.js
// ==/UserScript==
(function () {
var img = $('#comic > img');
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wildmichael
wildmichael / .gitattributes
Last active January 27, 2016 10:05
WPF DataGridRow Validation Test
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
@wildmichael
wildmichael / Coverage.targets
Created September 5, 2013 09:06
Run coverage analysis from MSBuild
<?xml version="1.0" encoding="utf-8"?>
<Project
DefaultTargets="Report"
ToolsVersion="4.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- versions of the required tools. ADJUST TO ACTUAL VERSION NUMBERS! -->
<xUnitVersion>1.9.2</xUnitVersion>
@wildmichael
wildmichael / README.md
Created March 1, 2013 11:24
superscript test

This is some superscript text.

@wildmichael
wildmichael / setup.py
Last active July 4, 2018 17:28
to_python converter sample to demonstrate the make_getter problem.
import os, sys
from distutils.core import setup, Extension
setup(name='stringTest',
ext_modules = [
Extension('_string', [
'string.cpp'
],
include_dirs = [
'/usr/include/qt4'
@wildmichael
wildmichael / brief.cls
Created June 28, 2012 14:43
Diacritics problem
%%
%% This is file `brief.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% brief.dtx (with options: `class')
%%
%% This is a generated file.
%% Copyright (C) 2012 by Michael Wild