Skip to content

Instantly share code, notes, and snippets.

@Cosmologist
Cosmologist / skype-bot-example.php
Created August 5, 2024 13:18
Simple Skype-bot to post messages to the Skype chat
<?php
/**
* Simple Skype-bot to post messages to the Skype chat
*
* <code>
* composer require "botman/botman" "botman/driver-botframework"
* </code>
*
* https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-quickstart?view=azure-bot-service-4.0
@Cosmologist
Cosmologist / js-open-binary-pdf-in-browser.js
Created November 26, 2024 19:23
JavaScript: How to display binary data like pdf (ie from XmlHttpRequest response) in the browser
// This required xhr.responseType="blob"
window.open(URL.createObjectURL(new Blob([xhr.response], {type: xhr.getResponseHeader('content-type')})));
@Cosmologist
Cosmologist / windows-schedule-unschedule-task-example.ps1
Created December 3, 2024 21:02
PowerShell: Schedule and unschedule task example (Windows cron)
$TASKNAME = "my-python-task"
$PYTHON = Resolve-Path -Path ".\venv\Scripts\python.exe"
$MAIN = Resolve-Path -Path ".\main.py"
$WORKINGDIR = Resolve-Path -Path ".\"
# Schedule
$Action = New-ScheduledTaskAction -Execute $PYTHON -Argument $MAIN -WorkingDirectory $WORKINGDIR
$Trigger = New-ScheduledTaskTrigger -Daily -At 3am
$Settings = New-ScheduledTaskSettingsSet