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/python | |
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| import argparse | |
| import readline | |
| import rlcompleter | |
| import shlex | |
| import os | |
| import re | |
| try: |
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 os | |
| import itertools | |
| import multiprocessing as mp | |
| from math import ceil | |
| from types import GeneratorType as generator | |
| from functools import partial | |
| from time import time | |
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
| <?php | |
| class T { | |
| protected $Context = array(); | |
| protected $Compiled = NULL; | |
| public $Regex_Variable = '~\{\{\s+[a-z_0-9\|:\.]+\s+\}\}~imsu'; | |
| public $Separator_Filter = '|'; | |
| public $Separator_Directive = ':'; | |
| protected $HTML_Encoder = NULL; | |
| protected $HTML_ENCODE = TRUE; | |
| protected $VALUE_CACHE = array(); |
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
| import redis | |
| from operator import methodcaller | |
| class RedisTransaction(object): | |
| def __init__(self, **kwargs): | |
| ''' Transaction timeout sets TTL for copied keys ''' | |
| if 'timeout' in kwargs: | |
| self.TRANSACTION_TIMEOUT = kwargs['timeout'] | |
| else: | |
| self.TRANSACTION_TIMEOUT = 10 |
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
| from random import getrandbits | |
| def probability_counter(counter=None): | |
| if counter is None: | |
| counter = 1 | |
| counter += int((getrandbits(counter) + 1) >> counter == 1) | |
| return counter |
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
| /* | |
| <div id="editor"></div> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
| <style> | |
| .clearfix:after { | |
| clear: both; | |
| } | |
| .clearfix:before, .clearfix:after { | |
| content: " "; | |
| display: table; |
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
| String.prototype.sub = function(regex, replacement){ | |
| var s = this.toString(); | |
| var matches = s.match(regex); | |
| if ( matches !== null ){ | |
| for(i in matches){ | |
| var item = matches[i]; | |
| if ( !item.escaped() ){ | |
| s = s.replace(item, replacement); | |
| } | |
| } |
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
| from resource import getrusage, RUSAGE_SELF | |
| def monitor(unit="M", alert=None): | |
| unit = unit.upper() | |
| unit_transformation = { | |
| "B" : 1./1024., | |
| "K" : 1., | |
| "M" : 1024., | |
| "G" : 1024.*1024., | |
| } |
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
| from sys import maxint | |
| from random import choice, sample, shuffle | |
| from string import ascii_uppercase as U, ascii_lowercase as L, digits as D, punctuation as P | |
| def populate(punctuation, extra): | |
| chars = U + L + D | |
| if isinstance(extra, basestring): | |
| chars += extra | |
| if punctuation: | |
| chars += P |
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
| -- Random integer between 2 signed integers | |
| DROP FUNCTION IF EXISTS RANDINT; | |
| DELIMITER // | |
| CREATE FUNCTION RANDINT(a INT, b INT) RETURNS INT | |
| BEGIN | |
| RETURN FLOOR( ABS(a-b) * RAND() ) + IF(a > b, b, a); | |
| END// |