Skip to content

Instantly share code, notes, and snippets.

@maphew
maphew / list-user-special-folders.py
Last active September 7, 2019 05:16
Windows user "special folders" (Desktop, Start Menu, Documents, ...) info by enumerating constants from MS published list
'''List all User Shell Folders via ID number.
An alternative to the usual
objShell = win32com.client.Dispatch("WScript.Shell")
allUserProgramsMenu = objShell.SpecialFolders("AllUsersPrograms")
because "These special folders do not work in all language locales, a preferred
method is to query the value from User Shell folders"
@maphew
maphew / snips-windows.py
Created August 28, 2019 19:54
Windows python snippets
def get_exe_types():
'''Return list of valid executable file extensions [.com, .exe, ...]'''
exetypes = [ext.lower() for ext in os.environ['PATHEXT'].split(os.pathsep)]
return exetypes
$ pip uninstall shortcutter
Uninstalling shortcutter-0.1.20:
Would remove:
c:\tools\miniconda3\envs\test\lib\site-packages\shortcutter-0.1.20.dist-info\*
c:\tools\miniconda3\envs\test\lib\site-packages\shortcutter\*
c:\tools\miniconda3\envs\test\scripts\shortcutter.exe
c:\users\me\appdata\roaming\microsoft\windows\start menu\programs\shortcutter.lnk
d:\test-link.lnk
Proceed (y/n)? y
ERROR: Exception:
@maphew
maphew / tb-edit.html
Created April 19, 2019 06:27
trumbowyg editor via cdn test
<html>
<head>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/Trumbowyg/2.15.2/ui/trumbowyg.min.css">
</head>
<body>
<div id="editor">
$('#trumbowyg-demo').trumbowyg();
</div>
Adapted from https://alex-d.github.io/Trumbowyg/documentation/
@maphew
maphew / win10-start-remove-internet-results.reg
Last active July 13, 2025 08:51
Disable internet search results in Win 10 Start Menu
Windows Registry Editor Version 5.00
;
; How to disable internet search results in start menu post Creators Update?
; https://superuser.com/questions/1196618/how-to-disable-internet-search-results-in-start-menu-post-creators-update
;
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search]
"BingSearchEnabled"=dword:00000000
"AllowSearchToUseLocation"=dword:00000000
"CortanaConsent"=dword:00000000
;
@maphew
maphew / find-leo-lib-using-leo.py
Last active February 28, 2019 06:37
Snippets for finding Leo's library path (ie: ./leo-editor/leo or PYTHONHOME/Lib/site-packages/leo)
# import pdb ; pdb = pdb.set_trace
import os
import sys
# Partial fix for #541.
# See https://stackoverflow.com/questions/24835155/pyw-and-pythonw-does-not-run-under-windows-7/30310192#30310192
if sys.executable.endswith("pythonw.exe"):
sys.stdout = open(os.devnull, "w");
sys.stderr = open(
os.path.join(os.getenv("TEMP"),
"stderr-"+os.path.basename(sys.argv[0])),

Leo 5.8.1 beta 1, http://leoeditor.com, is now available on GitHub.

Leo is an IDE, outliner and PIM, as described here.

  ![][22]   ![][10]   ![][11]
![][31]   ![][32]   ![][6]

@maphew
maphew / jeu-de-noe.html
Last active February 7, 2019 13:27
Jeu vidéo de NoéCourtesy of [lovasoa] 15yr old brother - https://news.ycombinator.com/item?id=18866500// source https://jsbin.com/cuqagav
<!doctype html>
<html>
<head>
<meta name="description" content="Courtesy of [lovasoa] 15yr old brother - https://news.ycombinator.com/item?id=18866500">
<meta charset='UTF-8'>
<title>Jeu vidéo de Noé</title>
</head>
<body style="text-align: center">
@maphew
maphew / hkcr-filezilla-url.reg
Last active May 18, 2022 01:31
Register FileZilla protocols with Windows
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\FileZilla.Url]
@="FileZilla URL"
"URL Protocol"=""
"EditFlags"=dword:00000002
"BrowserFlags"=dword:00000008
[HKEY_CLASSES_ROOT\FileZilla.Url\DefaultIcon]
@="\"C:\\Program Files\\FileZilla FTP Client\\filezilla.exe\",0"
@maphew
maphew / leo-screenshot.py
Created October 3, 2018 23:29
There is a screenshots plugin, but the following @button script seems more useful
'''
This script must be bound to a keystroke so that it can run without disturbing Leo's present state.
Rev 9cce9a in devel is required to make everything work smoothly when gathering arguments, but this
rev breaks other features. Back to the drawing board.
-- @edreamleo, https://groups.google.com/d/msg/leo-editor/Serzpyzrylg/B63pKXFNCwAJ
'''
@button screen-shot @key=ctrl-1
'''
Create a screenshot of the present Leo outline and