Skip to content

Instantly share code, notes, and snippets.

" Called with a command and a redirection target
" (see `:help redir` for info on redirection targets)
" Note that since this is executed in function context,
" in order to target a global variable for redirection you must prefix it with `g:`.
" EG call Redir('ls', '=>g:buffer_list')
funct! Redir(command, to)
exec 'redir '.a:to
exec a:command
redir END
endfunct
# the top-level file 'setup.py' from the possibly-broken BitTorrent-bencode python module.
from setuptools import setup, find_packages
setup(
name = "BitTorrent-bencode",
version = "5.0.8",
packages = find_packages(),
# metadata for upload to PyPI
author = "Bram Cohen",
" indent_fold_bug.vim
" Author: Ted Tibbetts
" License: WTFPL version 2 (http://sam.zoy.org/wtfpl/)
" Demonstrates a bug in vim's 'indent' foldmethod
" Usage: Two different options:
" $ vim -u indent_fold_bug.vim
" This will start vim, using this script as the vimrc.
" This option will ensure that default settings are used.
" :source indent_fold_bug.vim
" This will open a new tab and therein reproduce and analyze the bug.

followPreviousID

Moves backward and upward in the DOM to find the closest node with an ID attribute (i.e. one which can be targeted in the URL fragment). If it finds one, updates the document URL to include that fragment.

The main function is parameterized to allow the maximum search depth to be limited.

"""
>>> from copy import deepcopy
>>> pred = lambda v: v <= 2
>>> test_list = [1, 2, 1, 3, 1, 2, 4, 2, 3, 1]
>>> correct = [1, 2, 1, 1, 2, 2, 1]
... # the values from the list which are less than or equal to 2
>>> def dotest(cull, lst, pred):
... lst = deepcopy(lst)
... cull(lst, pred)
import os
import random
import re
import string
import time
def n_random_words(num_words=3000):
stat = os.stat('/usr/share/dict/words')
# the filesize if the 7th element of the array
@intuited
intuited / so_leaders.py
Created April 2, 2011 07:01
Show common leading users for 2 different SE sites.
"""Show common leading users for different SE sites.
Pass --grid from the command line to get a grid of common users
between askubuntu.com, unix.stackexchange.com,
superuser.com, and serverfault.com.
For the monthly report, it currently looks like this:
s s a u
e u s n
r p k i
@intuited
intuited / scrape-edhrec.js
Created April 24, 2019 18:21
Bookmarklet to scrape card names from EDHREC. For nefarious purposes only.
javascript:(function(){
els = document.getElementsByClassName("nwname");
a = Array.from(els);
strings = a.map(x => x.innerText.split(' // ')[0]);
console.log(strings.join('\n'));
})()
@intuited
intuited / gist:b229e4d049ce91b065cefee72dce207b
Created February 19, 2020 07:48
effective bonus/penalty from (dis-)advantage on D&D 5e d20 rolls
needed normally | equiv % with advantage | ADV bonus | equiv % with disadvantage | DISADV penalty
20 | 19 | +1 | 21 | -1
19 | 17 | +2 | 21 | -2
18 | 15.5 | +2.5 | 20.5 | -2.5
17 | 14 | +3 | 20 | -3
16 | 12 | +4 | 20 | -4
15 | 11 | +4 | 19 | -4
14 | 9.5 | +4.5 | 18.5 | -4.5
13 | 8 | +5 | 18 | -5
12 | 7 | +5 | 17 | -5

His mother was a Khoravar from the city of Sharn.  Something brought her into the depths of Khyber, and something brought her out half a world away in Xen'drik, where she made the company of a drow who would become Vespero's father.  They were separated, he was perhaps killed, and she was somehow returned to Sharn, to give birth to Vespero and raise him there.

He grew up, like his mother, a Dragonmarked member of House Medani.  With adulthood he secured a lucrative living as an investigator, tracking suspected murderers and uncovering ever deeper and darker mysteries.  His skillset grew from one very practical and straightforward to a much more esoteric body of knowledge as he studied the tongues and records of ancient empires.  A desire to retrace his mother's footsteps and meet his father's people became, slowly, over a lifetime of work, a grasping at the very nature of Eberron's existence.

He had found the words of Bri'Anne not at a temple, but in a fragment of a book written in Ancient Goblin, discovere