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
// My small, family IRC server | |
// | |
// This file won't compile by itself because it's only one file from | |
// my larger family server (movie hosting, Asterisk dialplan, Git | |
// hosting, personal assistant, etc). | |
// | |
// Users authenticate via NICK and PASS. The USER is interpreted as a | |
// "device" name. That allows each user to connect from multiple | |
// devices simultaneously while still appearing as only one nick in | |
// channels. Each nick-device combo has a queue of messages which |
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
# Python 2.7.14, PyCharm 2017.3.2 | |
from collections import defaultdict | |
some_default_dict = defaultdict(list) | |
some_default_dict[1] = 'a' | |
some_default_dict[2] = 'b' | |
some_objects = [{'id': i} for i in range(10)] | |
obj_by_id = {obj['id']: obj for obj in some_objects} |
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 TABLE t_random AS SELECT s, md5(random()::text) FROM generate_Series(1,5) s; | |
INSERT INTO t_random VALUES (generate_series(1,1000000000), md5(random()::text)); | |
SELECT pg_size_pretty(pg_relation_size('t_random')); |