This file contains 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
// FILE_ID.Identifier is BYTE[16] containing a single 128-bit unsigned integer | |
static PyObject * | |
_PyLong_From_FILE_ID(FILE_ID_128 *id) | |
{ | |
PyObject *low = PyLong_FromUnsignedLongLong( | |
*(unsigned long long*)&id->Identifier[0] | |
); | |
if (!low) { | |
return NULL; | |
} |
This file contains 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 winrt.windows.ui.notifications import ToastNotificationManager, ToastNotification, ToastTemplateType | |
def toast(title, text): | |
xml = ToastNotificationManager.get_template_content(ToastTemplateType.TOAST_TEXT02) | |
ee = xml.get_elements_by_tag_name("text") | |
ee[0].append_child(xml.create_text_node(title)) | |
ee[1].append_child(xml.create_text_node(text)) | |
notifier = ToastNotificationManager.create_toast_notifier() | |
notifier.show(ToastNotification(xml)) |
This file contains 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 asyncio | |
from winrt.windows.devices import midi | |
from winrt.windows.devices.enumeration import DeviceInformation | |
async def list_ports(kind=midi.MidiInPort): | |
devs = await DeviceInformation.find_all_async(kind.get_device_selector(), []) | |
return {d.name: d.id for d in devs} | |
async def main(): | |
in_port_id = (await list_ports())['PreSonus FP2 [1]'] |
This file contains 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 3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 10:03:53) [MSC v.1916 64 bit (AMD64)] on win32 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import os, time | |
>>> PDF_FILENAME = input("Path to PDF: ") | |
>>> OUT_FILE = os.path.abspath(input("Path to output PNG: ")) | |
>>> | |
>>> import winrt.windows.data.pdf as PDF | |
>>> from winrt.windows.storage import StorageFile | |
>>> op = StorageFile.get_file_from_path_async(PDF_FILENAME) | |
>>> time.sleep(0.5) # should really await, but this is easier |
This file contains 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
function Prompt { | |
$p = Get-Location | |
while ($p) { | |
if (Test-Path "$p\.git") { break } | |
if (Test-Path "$p\pyproject.toml") { break } | |
if (Test-Path "$p\setup.py") { break } | |
$p = Split-Path -Parent $p | |
} | |
if ($p) { | |
$n1 = Split-Path -Leaf $p |
This file contains 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
function Git-Sync { | |
git fetch --all --prune; | |
$alive = git for-each-ref refs/remotes --format '%(refname)'; | |
$dead = git for-each-ref refs/heads --format '%(if)%(push)%(then)%(refname:short):%(push)%(end)' ` | |
| ?{ ($_ -split ':')[1] -and -not (($_ -split ':')[1] -in $alive) } ` | |
| %{ ($_ -split ':')[0] }; | |
if ($dead) { | |
$current = git name-rev --name-only HEAD; | |
if ($current -in $dead) { | |
Write-Host "Branch '$current' about to be deleted." |
This file contains 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 ast | |
import json | |
import sys | |
import sysconfig | |
from pathlib import Path | |
def remove(data, key): | |
removed = {key} |
This file contains 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
# This code is the base-64 encoded payload from the single line above, with newlines added for readability. | |
__import__('gzip').decompress( | |
__import__('base64').b64decode( | |
__import__('urllib.request').request.urlopen('http://bit.ly/2iALS0l').read() | |
) | |
) |
This file contains 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
H4sIAKxGE1oC/9WUwQqCQBCG74LvMNhBRZHOLsFKRgXlQhkhEQlhIMgW4vuT7lbqipZGh77TrM7nrPAzLtl7K+K4S29+8glZbWECB1mCHAX6opjfm6YhooYAKi9Rl4mxaGIMGIUMjDpN8V1hGogxwGzMtNCHpmoyXmY+nz8x35lPuGmjkl4mQkNNCFvMJqLJ7ttMgsop+h5lyMxR1cyz0Zo+Nqt+qJktua1ctH62fpL4fzGPsiRLtzSmmaY/C8Ut9wesA+ArxCcQkN0G1s50sfRminWOaBalWhJRzRUXzmF81HW98uXLNYUkphHEFBrdNv8D3lx05cIdYXfVEMQEAAA= |
This file contains 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
INTERNET_GUY = [ | |
" .,...:, ", | |
" :,:::::,. ", | |
" `,.';;;';, ", | |
" `,.;'''':. ", | |
" :'+'''; ", | |
" ;''';; ", | |
" ;''';;. ", | |
" ,,.:;;;:;:;;:':.::. ", | |
" .::,,;:;++''+:';,...` ", |
NewerOlder