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 sys | |
import binascii | |
# wget https://raw.githubusercontent.com/SySS-Research/syss-crc/master/syss_crc.py | |
from syss_crc import CRC | |
def do_crc(data): | |
crc = CRC() | |
crc.set_config_by_name('CRC-32/JAMCRC') | |
return crc.compute(data) |
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 mamba import describe, context, it, before | |
from doublex import Spy, when, ANY_ARG | |
from expects import expect, raise_error | |
from doublex_expects import have_been_called_with, have_been_called | |
class SSHAutologin: | |
def __init__(self, expector): | |
self._expector = expector |
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 pexpect, struct, fcntl, termios, signal, sys | |
def sigwinch_passthrough (sig, data): | |
s = struct.pack("HHHH", 0, 0, 0, 0) | |
a = struct.unpack('hhhh', fcntl.ioctl(sys.stdout.fileno(), | |
termios.TIOCGWINSZ , s)) | |
if not p.closed: | |
p.setwinsize(a[0],a[1]) | |
# Note this 'p' is global and used in sigwinch_passthrough. |
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 tornado.web import Application | |
from tornado.ioloop import IOLoop | |
from tornado import web | |
class Collaborator: | |
def do_magic(self): | |
return "Hi all!" | |
class ByeHandler(web.RequestHandler): |
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 logging | |
import coloredlogs | |
def init_logger(dunder_name, testing_mode): | |
log_format = ( | |
'%(asctime)s - ' | |
'%(name)s - ' | |
'%(funcName)s - ' | |
'[%(levelname)s] - ' | |
'%(processName)s (%(process)d)' |
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 tornado.web import Application | |
from tornado.ioloop import IOLoop | |
from tornado import web | |
# Tornado lost logger otuput when logger apply dictConfig without explicit disable_existing_loggers to False | |
# infcommon https://github.com/aleasoluciones/infcommon | |
class Collaborator: | |
def do_magic(self): | |
return "Hi all!" |
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
## it solves the vim key issues when press keypad / | |
## it solves color terminal | |
## lets select using mouse and copy and paste for remote and local | |
## at started terminal, all terminal including the reduced window points are copied | |
set -g default-terminal "xterm-256color" | |
set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC" | |
# scrollback size | |
set -g history-limit 10000 |
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
class KeyValueTransparentCacheRepository(object): | |
def __init__(self, loader, keyvalue_client, key, ttl=constants.DEFAULT_CACHE_TTL): | |
self.loader = loader | |
self.keyvalue_client = keyvalue_client | |
self.key = key | |
self.ttl = ttl | |
def cache_wrapper(self, f): | |
def cache_logic(*args, **kwargs): |
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
#!/bin/bash | |
# this scripts do: | |
# - Marks current commit as production_<YYYYmmdd> | |
# - add commit descriptions between current and previous one having this pattern 'production_xxxxxx' | |
# It's needed to have previous tag for the first time, to obtain the difereneces between commits | |
# git tag production_XXXXXX <hash> | |
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
# requires to install jinja2 | |
# pip install jinja2 | |
import os | |
import sys | |
from jinja2 import Environment, FileSystemLoader | |
def jinja2file(source, dest): | |
template_dir = os.path.dirname(os.path.abspath(source)) | |
j2_env = Environment(loader=FileSystemLoader(template_dir), |