Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| // jQuery-like syntactic sugar. Only queries for one element. Does not loop over multiple like jQuery | |
| function $(query) { | |
| if (typeof query === 'undefined') throw 'No query provided to $'; | |
| var el; | |
| if (typeof query.nodeType === 'string') { | |
| el = query; | |
| } else if (typeof query === 'string' && query[0] === '<') { | |
| const container = document.createElement('div'); | |
| container.innerHTML = query; |
| // compile using: clang -fobjc-arc -framework AppKit bundlelessApplication.m -o bundleLess | |
| // | |
| // opens a NSApplication with dock icon and menu bar. NSRunningApplication will return no bundleURL for it | |
| // | |
| // via http://stackoverflow.com/questions/8137538/cocoa-applications-from-the-command-line | |
| // and http://casperbhansen.wordpress.com/2010/08/15/dev-tip-nibless-development/ | |
| #import <Foundation/Foundation.h> | |
| #import <Cocoa/Cocoa.h> |
| // | |
| // RVNReceiptValidation.m | |
| // | |
| // Created by Satoshi Numata on 12/06/30. | |
| // Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved. | |
| // | |
| // This sample shows how to write the Mac App Store receipt validation code. | |
| // Replace kRVNBundleID and kRVNBundleVersion with your own ones. | |
| // | |
| // This sample is provided because the coding sample found in "Validating Mac App Store Receipts" |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| 19.11.2013 13.41.32,403 secd[540]: securityd_xpc_dictionary_handler Fantastical[1799] copy_matching The operation couldn’t be completed. (OSStatus error -34018 - client has neither application-identifier nor keychain-access-groups entitlements) | |
| 19.11.2013 13.41.32,403 Fantastical[1799]: SecOSStatusWith error:[-34018] The operation couldn’t be completed. (OSStatus error -34018 - Remote error : The operation couldn‚Äôt be completed. (OSStatus error -34018 - client has neither application-identifier nor keychain-access-groups entitlements)) | |
| 19.11.2013 13.41.32,406 secd[540]: securityd_xpc_dictionary_handler Fantastical[1799] copy_matching The operation couldn’t be completed. (OSStatus error -34018 - client has neither application-identifier nor keychain-access-groups entitlements) | |
| 19.11.2013 13.41.32,406 Fantastical[1799]: SecOSStatusWith error:[-34018] The operation couldn’t be completed. (OSStatus error -34018 - Remote error : The operation couldn‚Äôt be completed. (OSStatus error -34018 - client has neith |
| /* tlsprox - minimal tls MITM transparent proxy... in go! | |
| * by @tam7t | |
| * | |
| * Usage: | |
| * If we want to MITM https://example.com first get example.com's ip address | |
| * then add localhost to /etc/hosts: | |
| * | |
| * 127.0.0.1 example.com | |
| * | |
| * > go build tlsprox.go |
| /* | |
| Code to paste and run in the Browser Console | |
| Requires devtools.chrome.enabled => true in about:config | |
| Tested in Firefox 68.0.1 on Windows | |
| */ | |
| // Create references to APIs we'll use | |
| var ss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); | |
| var io = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
| var ds = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties); |
| if(!String.prototype.matchAll) { | |
| String.prototype.matchAll = function (rx) { | |
| if (typeof rx === "string") rx = new RegExp(rx, "g"); // coerce a string to be a global regex | |
| rx = new RegExp(rx); // Clone the regex so we don't update the last index on the regex they pass us | |
| let cap = []; // the single capture | |
| let all = []; // all the captures (return this) | |
| while ((cap = rx.exec(this)) !== null) all.push(cap); // execute and add | |
| return all; // profit! | |
| }; | |
| } |
| (() => { | |
| const isNotUndefined = typeofResult => typeofResult !== 'undefined'; | |
| if(isNotUndefined(typeof globalThis) && globalThis.globalThis === globalThis) { return; } | |
| const g = (isNotUndefined(typeof window) && window) | |
| || (isNotUndefined(typeof global) && global) | |
| || (isNotUndefined(typeof self) && self) | |
| || Function('return this')(); | |
| g.globalThis = g; | |
| })(); |
The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse