Skip to content

Instantly share code, notes, and snippets.

// ==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');
@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):
@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 / 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"),