Skip to content

Instantly share code, notes, and snippets.

;Copyright 2004, 2005, 2008 Alex Walters.
on *:text:!dice help:*:{
notice $nick !dice <pool> <target> [action] (Botch 1)
notice $nick !sdice <pool> <target> [action] (10's rerolled, Botch 1)
notice $nick !xdice <pool> <target> [action] (9's rerolled, Botch 1)
notice $nick !nwod <pool> [action] (10's rerolled, target 8)
notice $nick !9nwod <pool> [action] (9's rerolled, target 8)
notice $nick !8nwod <pool> [action] (8's rerolled, target 8)
notice $nick !cnwod [action] (10's rerolled, target 10, Botch 1)
}
@tritium21
tritium21 / hacks.py
Last active June 29, 2016 20:22
These are my hacks
# Punich those who import *
__all__ = type('__all__', (object,), {'__getitem__': lambda self, index: __import__('types').FunctionType(compile('raise ImportError("Loli Haet \'from foo import *\'")', __name__, 'single'), globals())()})()
import os.path
import tempfile
import StringIO
import os
import sys
class AtomicOpen(StringIO.StringIO, object):
"""A file-like context manager for atomicly writing files
"""
import argparse
import logging
import os
import sys
def kill_it(
base_path=os.getcwd(),
thumbsdb='Thumbs.db',
unlink=True,
"""
Today I learned... How both super and method binding works. /hack
"""
import functools
import types
class Duper(object):
"""
A very simplistic reimplementation of super().
if __name__ == '__main__':
import sys
import os
if sys.flags.interactive and os.environ['PYTHONSTARTUP']:
execfile(os.environ['PYTHONSTARTUP'], globals())
@tritium21
tritium21 / lastlog.py
Last active September 18, 2015 18:32
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import argparse
import collections
import datetime
import operator
import os.path
import struct
import sys
def comp():
import readline
import sys
try:
# python >= 3.something
del sys.__interactivehook__
except AttributeError:
pass
try:
#!/bin/sh
""":"
which python3 >/dev/null 2>&1 && exec python3 "$0" "$@"
which python >/dev/null 2>&1 && exec python "$0" "$@"
which python2 >/dev/null 2>&1 && exec python2 "$0" "$@"
echo "Error: configure wrapper requires python"
exec echo "Either install python, or use cmake directly"
":"""
#include <Python.h>
#include <windows.h>
#ifdef _CONSOLE
char script[] = "from collector import run\nimport sys\nsys.exit(run(sys.argv[1:]))";
int
wmain(int argc, wchar_t *argv[])
#else
char script[] = "from collector import run_gui\nimport sys\nsys.exit(run_gui(sys.argv[1:]))";