View asyncio_executors_threads_procs.py
#!/usr/bin/env python3 | |
# Combining coroutines running in an asyncio event loop with | |
# blocking tasks in thread pool and process pool executors. | |
# | |
# Based on https://pymotw.com/3/asyncio/executors.html, but this version runs both | |
# threads and processes at the same time and interleaves them with asyncio coroutines. | |
# | |
# All appears to be working. | |
# |
View pebble-time-kickstarter-info
// ==UserScript== | |
// @name pebble kickstarter test | |
// @namespace http://your.homepage/ | |
// @version 0.2 | |
// @description Adds hidden tracking info to the kickstarter page (and logs it to the js console) | |
// @author John Markus Bjørndalen | |
// @match https://kickstarter.getpebble.com/pledges/* | |
// @grant none | |
// ==/UserScript== | |
View ScriptCraft-falldamage1
events.damage(function(event) { | |
// Wearing a pumpkin on your head protects you from fall damage | |
var src = event.getDamageSource(); | |
if (src.getDamagetype() == Packages.net.canarymod.api.DamageType.FALL) { | |
var def = event.getDefender() | |
var isPlayer = (def instanceof Packages.net.canarymod.api.entity.living.humanoid.Player); | |
if (isPlayer) { | |
var inv = def.getInventory(); | |
var head = inv.getSlot(39); | |
if (head) { |