Skip to content

Instantly share code, notes, and snippets.

View haliphax's full-sized avatar
💭
git clone self

haliphax

💭
git clone self
View GitHub Profile
@haliphax
haliphax / README.md
Last active August 28, 2018 17:47
Roll20 NPC spell slots bookmarklet

Roll20 NPC spell slots bookmarklet

This bookmarklet can be used to produce a clickable list of spells for an NPC chat macro. You input the spell level (0 for cantrips), the number of slots available for that level, and it will produce the markup to put into a chat macro.

As far as building the shell for the spellbook is concerned, this should get you started:

/w GM &{template:default}{{name=@{selected|character_name} Spellcasting
}}{{ DC @{selected|spell_save_dc} = +@{selected|spell_attack_bonus} to hit
}}{{ Cantrips = [@{selected|repeating_spell-cantrip_$0_spellname}](~selected|repeating_spell-cantrip_$0_spell)
@haliphax
haliphax / nodechat.py
Created May 25, 2018 03:50
nodechat.py band-aid version cannibalized from ircchat.py
""" Node chat script for x/84. Bastardized from ircchat.py. """
# stdlib
from collections import deque
import datetime
import re
import warnings
# 3rd party
from x84.bbs import (ScrollingEditor, getsession, echo, getterminal,
get_ini, syncterm_setfont, LineEditor)
<?php
/***
* Pull HTML source for given URL and format for output
* 2011 haliphax https://github.com/haliphax
**/
?>
<!DOCTYPE html>
<html>
<head>
<title>Format page as plain text</title>
@haliphax
haliphax / wpx
Last active April 26, 2017 04:19
automagic WINEPREFIX script
#!/usr/bin/env bash
# Copyright (c) 2016 haliphax
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@haliphax
haliphax / jquery.inview.js
Created April 20, 2016 17:11
jQuery :inview and :reached psuedo-selectors
// jQuery pseudo-selectors to figure out if an element is on-screen
$.extend($.expr[':'], {
// determines if the element is within the viewport
'inviewport': function (el) {
var $el = $(el)
, h = $el.outerHeight()
, t = $el.offset().top
, b = t + h
, s = $(document).scrollTop()
, w = $(window).height()
@haliphax
haliphax / vtecho.py
Created February 25, 2016 21:35
Player script for textfiles.com VT100 animations
#!/usr/bin/env python2.7
"""
This script will echo each line in either stdin or a given file,
with a 1/50th of a second delay between each. This makes it
suitable for "playing" the animations found on textfiles.com:
http://artscene.textfiles.com/vt100/
Just use it like this:
@haliphax
haliphax / SumFile.fs
Last active February 28, 2024 18:25
Sum all of the lines in a given file which are integers
open System.IO
// sums up all of the lines in a given file
let sumFile (fileName:string) =
// wrapper for catching int conversion exceptions
let wrapper (sr:System.IO.StreamReader) =
try
int (sr.ReadLine())
with
| :? System.FormatException -> 0
@haliphax
haliphax / ProperCase.fs
Last active February 28, 2024 18:25
Capitalize a given string using Proper Case (dipping a toe into the F# water)
// capitalizes the first letter of every word in the given string
let properCase (s:string) =
// recursive helper function
let rec helper (s:string) (i:int) (capitalize:bool) (result:string) =
// if we're at the end of the string, return our result
if s.Length - 1 < i then
result
else
// recurse to the next character in the input string
(helper s (i + 1) (s.[i] = ' ') (result +
#!/usr/bin/env bash
VERB=enable
KEYBOARD_ID=12
TOUCHPAD_ID=13
[ -z "$(xinput list-props 13 | grep -e 'Device Enabled.*:.*0')" ] && VERB=disable
xinput $VERB $KEYBOARD_ID
xinput $VERB $TOUCHPAD_ID
@haliphax
haliphax / udinventory.user.js
Last active March 30, 2020 15:33
UD Inventory (userscript)
// ==UserScript==
// @author haliphax
// @include http://*urbandead.com/map.cgi*
// @exclude http://*urbandead.com/map.cgi?log*
// @name UDInventory
// @namespace https://roadha.us
// @description (Urban Dead) Groups items together in your inventory and squashes mall search
// @version 1.1
// ==/UserScript==