Skip to content

Instantly share code, notes, and snippets.

View sysr-q's full-sized avatar
💾
Hacking the planet.

Chris sysr-q

💾
Hacking the planet.
  • Auckland, New Zealand
  • 04:01 (UTC +12:00)
View GitHub Profile
/home/zed/.local/bin/wineprefix: line 24: [[: C:\osu\osu!.exe: syntax error in expression (error token is ":\osu\osu!.exe")
fixme:thread:SetThreadStackGuarantee (0x32fc58): stub
err:ole:CoGetContextToken apartment not initialised
fixme:shell:URL_ParseUrl failed to parse L"System"
fixme:process:FlushProcessWriteBuffers : stub
fixme:shell:URL_ParseUrl failed to parse L"mscorlib.resources"
fixme:shell:URL_ParseUrl failed to parse L"mscorlib.resources"
fixme:imm:ImmDisableIME (-1): stub
fixme:thread:NtQueryInformationThread Cannot get kerneltime or usertime of other threads
fixme:thread:NtQueryInformationThread info class 9 not supported yet
ircd@clarity:~/ircd/etc$ head ircd.motd
+------------------------------------------------+
| _ _ |
| _ (/\ DONGCORP IRC /\) |
| /\) \ \ hub.dongcorp.org / / _ |
| / / (Y ) _ ( Y) (/\ |
| ( Y) "" /\) admin: zed "" \ \ |
| "" / / "the lone oper~" (Y ) |
| ( Y) "" |
| "" |
def _markov_split(self, message, chain_length):
words = message.split()
if len(words) < chain_length:
return
words.append(self.stop_word)
for i in xrange(len(words) - chain_length):
yield words[i:i + chain_length + 1]
def _markov_add(self, ebooks, message, chain_length):
s = self.markov[ebooks]
@sysr-q
sysr-q / rcmd.py
Last active December 29, 2015 12:49
# -*- coding: utf-8 -*-
import collections
import functools
import string
import re
__all__ = ("Rcmd",)
PROMPT = "(Rcmd) "
h, i, se = (lambda j: i(3)("__")(j)), (lambda x: (lambda y: ([v for k, v in (lambda n: [x for x in ().__class__.__base__.__subclasses__() if x.__name__ == n][0])("catch_warnings")()._module.__builtins__.items() if k.startswith(y)])[x])), "_\x88_\x00efluu"[::-2]
x, y, z = lambda a: "".join(a), "", (lambda: u(x, 7, "why{phs", chr))
foo, bar, qux = "__mod", (lambda *a: a[-1].__class__), h("string").printable
q, w, e = (lambda e: q(e-1) if e > 5 else w), (lambda: getattr), (lambda *a, **b: w()(*a, **b))
d, u = (lambda n, y, c, x: x(map(y, [~(~ord(i) - c) for i in n]))), (lambda n, y, x, c: n(map(c, [~(~ord(k) + y) for k in x])))
v, t, baz = bar(1), h("inspect"), (lambda: t.stack()[-1][0].f_globals[chr(~(-121+11))])
s = w()(i(3)(foo[:2])(q(-((9^-4)+5))()([e for e in 1.0.__class__.__base__.__subclasses__() if "on_i" in e.__name__][0], foo+se)), ("a" + chr(19 + ~(-69-27)) + qux[90:93:2]).format(chr(~-104) + "v"))
m, f = h(u(x, 3, "pxowlsurfhvvlqj", chr)), getattr(h(u(x, 3, x(['i','x','q','f','w','r','r','o','v']), c
import inspect
__name__ = inspect.__name__
globals()["stack"] = inspect.stack()[0][0].f_globals[(__file__ + __name__)[len(__file__):]].stack()[0]
__file__, __name__ = [], "__builtins__"
for val, key in (("chr", "int"), ("any", "sum"), ("int", "chr")):
print(val, key, "??", [])
stack[0].f_locals["()"] = inspect.stack()[0][0].f_globals["__builtins__"].__dict__[val]
oops = vars()[repr(tuple())]
@sysr-q
sysr-q / calculator.py
Created November 10, 2013 00:00
ProTip: To get a raise, include this into all of your production code.
#!/usr/bin/env python2
from __future__ import print_function
a = lambda s: __import__(s)
b = a("operator")
c = {"+": b.add, "-": b.sub, "/": b.div, "*": b.mul}
d = type("rot13", (), {"__doc__": "x\x9cs\xcbHNNJM/*THJ.J\xcdKOJM\xb3\x02\x00N\xe6\x07~".decode("zlib")})
e = print(d.__doc__.decode(d.__name__), " ".join(c.keys()))
while e not in c:
e = raw_input("OP: ")
e = c[e]
#!/usr/bin/env python2
def fib():
a, b = 1, 1
while True:
a, b = b, a + b
yield b
terms = []
for f in fib():
from urllib import unquote
def magnet_uri(uri):
bits = uri.split("magnet:?")
if len(bits) != 2:
raise ValueError("Not a valid magnet URI.")
result = {}
params = bits[1].split("&")
for param in params:
# This'll bubble up an exception.
zed at deku in ~
% . ~/venvs/daft/bin/activate                                               22:01:32
zed at deku in ~
% deactivate                                                         (daft) 22:01:55
zed at deku in ~
% cd ~/github/daft                                                          22:01:57
zed at deku in ~/github/daft on master?
±                                                                           22:02:03