This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTENSION plpython2u; | |
-- TODO: | |
-- 1) Кэш соединения с ZMQ | |
-- 2) Найти оптимальный способ сериализаци данных | |
-- 3) Рассмотреть вариант с LISTEN/NOTIFY и PGQ | |
CREATE OR REPLACE FUNCTION row_trigger() | |
RETURNS TRIGGER | |
AS $$ | |
import json, zmq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
#------------------------------------------------------------------------------ | |
# Imports | |
#------------------------------------------------------------------------------ | |
# Stdlib | |
import os | |
import re | |
# 3rdparty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import curses | |
import random | |
stdscr = curses.initscr() | |
curses.noecho() | |
curses.cbreak() | |
stdscr.keypad(1) | |
curses.halfdelay(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
Building (Python3.4): | |
> cython --embed window.pyx | |
> gcc -I/usr/include/python3.4m -o window -lpython3.4m -lpthread -lm -lutil -ldl | |
""" | |
#------------------------------------------------------------------------------ | |
# Imports | |
#------------------------------------------------------------------------------ | |
import logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# buggy - no sound | |
gst-launch-1.0 -v souphttpsrc location="http://hlsstr03.svc.iptv.rt.ru/hls/CH_2X2/variant.m3u8" ! hlsdemux ! tsdemux ! h264parse ! avdec_h264 ! autovideosink | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# largely purloined from http://www.perlmonks.org/?node_id=1093916 as my PoC for the old options overflow proved too messy^wPerlish to rework - [machine] | |
use strict; | |
use IO::Socket; | |
use Net::DHCP::Packet; | |
use Net::DHCP::Constants; | |
my $server_ip = "10.10.10.1"; |
NewerOlder