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
#!/usr/bin/env python3 | |
""" | |
This is a quick hack that is intended to be used as a tool to help diagnose | |
high CPU usage by what should be an idle minecraft server. | |
Use with care! It may break things. | |
Needs to run as root to work. | |
The main problem is that Minecraft appears to be running parkNanos in a tight | |
loop with a very low timeout. Linux has higher precision timeouts by default | |
than, for instance, Windows. When this happens, you can observe that Minecraft |
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
#!/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. | |
# |
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
// ==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== | |
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
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) { |