Skip to content

Instantly share code, notes, and snippets.

This filters out "left", "right", "up", etc. as well as
* Small mistypes (aka "up]")
* "naked jenna" spam
Derived shamelessly from the other public filter scripts; I just changed the matching pattern. Paste in console (CTRL+ALT+J in Chrome). PS: Only do so to scripts you trust, as they can be malicious.
WARNING: MAY NEED YOU TO REFRESH FIRST TO REMOVE OTHER SIMILAR SCRIPTS THAT ARE RUNNING.
--------
# Customise this to allow things to have the mouse but not the keyboard.
# It's just regex and matches this window name.
ALLOWED='^(i3(bar\ .*)?|)$'
REPEAT=false
while true; do
eval $(xdotool getmouselocation --shell)
# Uncomment for helping data to use when editing $ALLOWED.
def false(false):
return false(false)
@false
def false(false=𝔽𝕒𝕝𝕤𝕖):
class false:
def __bool__(self):
if 𝔽𝕒𝕝𝕤𝕖:
nonlocal false
try:
# Yes, you can have apostrophes in your identifiers.
Shellyʼs = ["balloon"]
Johnʼs = []
Johnʼs.extend(Shellyʼs.pop())
Shellyʼs
Johnʼs
@Veedrac
Veedrac / injections.py
Last active August 29, 2015 14:01
A little module to make a little thing a little easier... OK a lot easier, but whatever!
"""
A small 1-to-1 dictionary library. Shares inspiration from bidict:
https://pypi.python.org/pypi/bidict/0.1.1
Implementation similarities are mostly coincidental. The ordered variant
was an idea stolen from
https://bitbucket.org/jab/bidict/issue/1/ordereddict-integration
from timeit import Timer
from functools import partial
def add_string(n):
s = ''
for _ in range(n):
s += ' '
def add_string_in_list(n):
l = ['']
@Veedrac
Veedrac / accessor.cpp
Last active August 29, 2015 14:04
Getter-Setter vs Properties
///
/// The class to hold an object's information so that the Engine can
/// manipulate it.
///
///
///
class Object {
protected:
///
/// The object's renderable component
@Veedrac
Veedrac / mediocre_mandelbrot.py
Last active August 29, 2015 14:05
Significantly more complicated than justified, but eeking out that last 50% felt important...
import sys
import numpy
import numexpr
numexpr.set_num_threads(2)
CHUNKS = 256
def mandel_unroll_numexpr(n, z="z", c="c"):
"""
Generate a numexpr for the core mandelbrot loop (z = z ** 2 + c)
@Veedrac
Veedrac / Pandas core dump.txt
Created September 11, 2014 15:12
Pandas core dump
*** Error in `python': free(): invalid pointer: 0x00007fd64024d530 ***
======= Backtrace: =========
/usr/lib/libc.so.6(+0x73f8e)[0x7fd65c1dcf8e]
/usr/lib/libc.so.6(+0x7988e)[0x7fd65c1e288e]
/usr/lib/libc.so.6(+0x7a04b)[0x7fd65c1e304b]
/usr/lib/python3.4/site-packages/numpy/core/multiarray.cpython-34m.so(+0xc842c)[0x7fd65ad1242c]
/usr/lib/python3.4/site-packages/numexpr/interpreter.cpython-34m.so(_Z11NumExpr_runP13NumExprObjectP7_objectS2_+0xc58b)[0x7fd652d8f68b]
/usr/lib/libpython3.4m.so.1.0(PyObject_Call+0x88)[0x7fd65c797e68]
/usr/lib/libpython3.4m.so.1.0(PyEval_EvalFrameEx+0x1091)[0x7fd65c846721]
/usr/lib/libpython3.4m.so.1.0(PyEval_EvalCodeEx+0x879)[0x7fd65c84e289]
#include <iostream>
#include <iterator>
#include <numeric>
#include <unordered_set>
#include <vector>
int32_t some_calculations(int32_t number) {
std::vector<int32_t> a;
std::unordered_set<int32_t> s;