Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python2
import curses
import random
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(1)
curses.halfdelay(1)
@movEAX
movEAX / gist:7ca78153e5eaf0eafd98
Last active August 29, 2015 14:20
Replace short links in text to full links
import requests
import re
DOMAINS = ['bit.ly']
PATTERN = 'https?://{}/\w+'
def expand_short_url(short_url):
resp = requests.get(short_url, allow_redirects=False)
return resp.headers['location']
@movEAX
movEAX / gist:2efbd42450cfab72f4e6
Created May 19, 2015 21:28
XML scheme definition draft
struct Attribute {
name: &str
required: bool
}
let attr: Attr = Default::default();
let nested: Nested = Default::default();
let baseColor = OOXMLObjectBuilder::base()
.def(Attr {name: "auto", ..attr}
.def(Attr {name: "indexed", ..attr}
@movEAX
movEAX / gist:d47dae4ca517172f87c6
Created September 3, 2015 22:35
SEND + MORE = MONEY (python3)
from itertools import permutations
for p in permutations(range(10)):
(s,e,n,d,m,o,r,y,*_) = p
send = (10*(10*(10*s+e)+n)+d)
more = (10*(10*(10*m+o)+r)+e)
money = (10*(10*(10*(m+o)+n)+e)+y)
if send + more == money:
print('send=%d', send)
print('more=%d', more)
mondrian.rolap.queryTimeout - we set it typically to 60 seconds to cancel too long running ad-hoc queries which generate too much load on the server
mondrian.rolap.maxQueryThreads - increase it to higher number to allow more parallel Mondrian query threads if you have many concurrent users
mondrian.rolap.cellBatchSize - we have been experimenting with this value but typically set it to 100000 (which is now the default value for Mondrian), by changing it you can modify batch size when retrieving large set of result cells
mondrian.native.ExpandNonNative - set to true to expand more MDX expressions to SQL
mondrian.rolap.evaluate.MaxEvalDepth - we set it to 20 as otherwise sometimes more complex MDX calculated members were failing
mondrian.rolap.EnableInMemoryRollup - we set it to false as we have some multi-valued dimensions which cannot be rolled up by making sum of measure values for detailed members therefore we always want rollup to be calculated using SQL
mondrian.util.memoryMon