This file contains hidden or 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 python | |
| import logging | |
| import multiprocessing as mp | |
| import os | |
| import okaara | |
| import subprocess | |
| import sys | |
| import signal | |
| import textwrap |
This file contains hidden or 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
| """ | |
| Entry point for both the admin and consumer clients. The config file location | |
| is passed in and its contents are used to drive the rest of the client execution. | |
| """ | |
| from gettext import gettext as _ | |
| import logging | |
| import logging.handlers | |
| from optparse import OptionParser | |
| import os |
This file contains hidden or 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
| http://www.ac-web.org/forums/showthread.php?176819-How-to-RBAC | |
| ::::GROUPS:::: | |
| 1 = Player | |
| 2 = Moderator | |
| 3 = GameMaster | |
| 4 = Administrator | |
| ::::Permissions:::: | |
| 1 = Instant logout |
This file contains hidden or 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
| -- http://www.ac-web.org/forums/showthread.php?176819-How-to-RBAC | |
| SET FOREIGN_KEY_CHECKS=0; | |
| -- ---------------------------- | |
| -- Table structure for `rbac_account_groups` | |
| -- ---------------------------- | |
| DROP TABLE IF EXISTS `rbac_account_groups`; | |
| CREATE TABLE `rbac_account_groups` ( | |
| `accountId` int(10) unsigned NOT NULL COMMENT 'Account id', |
This file contains hidden or 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
| #a server test that would run a series of client tests based on args from a config file | |
| #here we create a server test names testserver in ~/server/tests directory | |
| #server test python file | |
| #################################################### | |
| cat server/tests/testserver/testserver.py | |
| from autotest.server import autotest_remote, hosts, subcommand, test |
This file contains hidden or 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
| http://www.youtube.com/watch?v=iGtM_OP01FU |
This file contains hidden or 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
| def wrap(*args, **kwargs): | |
| print "wrap" | |
| def wrap_this_func(func): | |
| print "wrap_this_func" | |
| def this_func_args(*wargs, **wkwargs): | |
| print "this_func_args" | |
| print "before" | |
| print "after" | |
| return func(*wargs, **wkwargs) | |
| return this_func_args |
This file contains hidden or 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
| http://www.electricmonk.nl/log/2008/08/07/dependency-resolving-algorithm/ | |
| Here's a little explanation of a possible dependency resolution algorithm. I've made this as basic as possible, so it's easy to understand. If you're at home in (graph) algorithms, this post is probably not of much interest to you. | |
| Premise | |
| Suppose we have five objects which all depend on some of the other objects. The objects could be anything, but in this case let's say they're very simple software packages (no minimal versions, etc) that depend on other packages which must be installed first. How does one find the right order of installing the packages? | |
| Take, for instance, the following scenario: Software package 'a' depends on 'b' and 'd'. 'b' depends on 'c' and 'e'. 'c' depends on 'd' and 'e'. 'd' depends on nothing, nor does 'e'. When we visualize this, we get something like this: |
This file contains hidden or 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 perl | |
| use strict; | |
| use warnings; | |
| use 5.016; | |
| use Data::Dump qw(dump); | |
| use MCE; | |
| my $mapper = { | |
| 1 => sub { say join " ", $$, 1; }, |
This file contains hidden or 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
| # "Understanding Python's closures". | |
| # | |
| # Tested in Python 3.1.2 | |
| # | |
| # General points: | |
| # | |
| # 1. Closured lexical environments are stored | |
| # in the property __closure__ of a function | |
| # | |
| # 2. If a function does not use free variables |