Skip to content

Instantly share code, notes, and snippets.

public async Task KillProcessNicely(uint pid, int delayInMs = 3*1000)
{
// Ugh, this is gross - https://stackoverflow.com/questions/16653517/how-best-to-post-wm-quit-to-a-running-process
var tids = NativeMethods.GetAllTopLevelWindowsInZOrder()
.Select(hwnd => {
uint wndpid = 0;
var tid = NativeMethods.GetWindowThreadProcessId(hwnd, out wndpid);
if (wndpid != pid) {
return (uint)0;
}
@joebeeson
joebeeson / auto-arlo.groovy
Last active October 18, 2018 04:15
AutoArlo
/**
* AutoArlo
*
* Created by Joe Beeson <jbeeson@gmail.com>
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
@gnarf
gnarf / jQuery.ajaxQueue.min.js
Created June 21, 2011 23:52
jQuery.ajaxQueue - A queue for ajax requests
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).done(e.resolve).fail(e.reject).then(b,b)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)