Skip to content

Instantly share code, notes, and snippets.

Avatar

John Markus Bjørndalen jmbjorndalen

View GitHub Profile
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) {
@jmbjorndalen
jmbjorndalen / pebble-time-kickstarter-info
Last active Aug 29, 2015
Quick and dirty tampermonkey hack to view some of the hidden information on the Pebble Time Kickstarter webpage
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==
@jmbjorndalen
jmbjorndalen / asyncio_executors_threads_procs.py
Created Apr 26, 2018
Combining Python 3 asyncio coroutines with thread pool and process pool executors
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.
#
You can’t perform that action at this time.