Skip to content

Instantly share code, notes, and snippets.

@wildmichael
wildmichael / ConvertXmlSpreadsheetToTable.pqm
Last active May 28, 2021
Power Query function to convert a Excel XML Spreadsheet to a table
View ConvertXmlSpreadsheetToTable.pqm
(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 Aug 8, 2020
Temporarily enable Windows Store
View EnableStore.ps1
# 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 Jan 31, 2018
Small utility to easily create a document tree with BeautifulSoup4
View bs4_tree_construct.py
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):
View xkcd_display_title.user.js
// ==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');
View ggplot_wrong_color_scale.ipynb
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 Jan 27, 2016
WPF DataGridRow Validation Test
View .gitattributes
###############################################################################
# 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 Sep 5, 2013
Run coverage analysis from MSBuild
View Coverage.targets
<?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>
View README.md

This is some superscript text.

@wildmichael
wildmichael / setup.py
Last active Jul 4, 2018
to_python converter sample to demonstrate the make_getter problem.
View setup.py
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 Jun 28, 2012
Diacritics problem
View brief.cls
%%
%% 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