This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
print_table will print a structured table with headers, defined column widths, and automatic text wrapping in columns. | |
It will also determine the terminal width and reduce the column widths automatically so they all fit without wrapping outside of the table | |
print_table requires 3 parameters | |
headers: A list or tuple of headers (strings) | |
rows: A list of lists or tuples with table row information as strings | |
each entry in inner list maps to a column. | |
For a 3 column table, provide a list of lists or tuples with a length of 3 | |
sizes: A list or tuple of integers specifying maximum column width for each column. Must provide a value for each column. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
help = """Simple script to append text to specified files before the extension | |
usage: append (-n)(-i) "text to append" files | |
-n: dry-run, will show before and after filenames without making changes | |
-i: ignore file extensions and just append to the end of the filename | |
append " (2017)" *.docx | |
'outline.docx' -> 'outline (2017).docx' | |
append -i ".(DRAFT)" * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Flask will display a warning everytime you startup your application if you are not using it in behind a separate WSGI server. | |
* Environment: production | |
WARNING: Do not use the development server in a production environment. | |
Use a production WSGI server instead. | |
This was not relevant for my scenario and I wanted the message gone, | |
so using this method will remove their ability to print that message | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
; removing libraries requires additional work you need to take ownership of the key and give yourself permissions to it first | |
; HKEY_CLASSES_ROOT\CLSID\{031E4825-7B94-4dc3-B131-E946B44C8DD5}\ShellFolder | |
; Attributes (dword) b080010d -> b090010d | |
;Camera Roll | |
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{3B193882-D3AD-4eab-965A-69829D1FB59F}] | |
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{3B193882-D3AD-4eab-965A-69829D1FB59F}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-AppxPackage *3dbuilder* | Remove-AppxPackage | |
Get-AppxPackage *3DViewer* -AllUsers | Remove-AppxPackage | |
Get-AppxPackage *windowsalarms* | Remove-AppxPackage | |
Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage | |
Get-AppxPackage *windowscamera* | Remove-AppxPackage | |
Get-AppxPackage *officehub* | Remove-AppxPackage | |
Get-AppxPackage *skypeapp* | Remove-AppxPackage | |
Get-AppxPackage *getstarted* | Remove-AppxPackage | |
Get-AppxPackage *gethelp* | Remove-AppxPackage | |
Get-AppxPackage *zunemusic* | Remove-AppxPackage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
user32 = ctypes.windll.user32 | |
# get screen resolution of primary monitor | |
res = (user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)) | |
# res is (2293, 960) for 3440x1440 display at 150% scaling | |
user32.SetProcessDPIAware() | |
res = (user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)) | |
# res is now (3440, 1440) for 3440x1440 display at 150% scaling |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -c "import os; os.system('mode con: cols=75 lines=25')" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from win32api import Beep as b | |
# Close Encounters with win32api beep in python | |
# d4 e4 c4 c3 g3 | |
# b(frequency, duration) | |
# thanks to https://forums.parallax.com/discussion/65026/close-encounter-tones | |
b(293, 1000) | |
b(329, 1000) | |
b(261, 1000) | |
b(130, 1000) | |
b(196, 2000) |
Requires MathJax, Renders in Stackedit.io
<script type="text/javascript" src="https://stackedit.io/libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>|||||||||||||||
:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|
NewerOlder