#!/usr/bin/env python from flufl.i18n import initialize import os os.environ['LANG'] = 'en' os.environ['LOCPATH'] = './build/mo' _ = initialize('test_i18n') with _.using('en'): print _("iface.linkstate.admindown")
from __future__ import division, absolute_import, print_function from logging import Formatter, DEBUG, INFO, WARNING, ERROR, CRITICAL import os from colorama import Fore, Style from pkg_resources import resource_filename try: from flufl.i18n import initialize except ImportError: pass try: os.environ['LOCPATH'] = resource_filename(__name__, 'share') _ = initialize('pat') except (KeyError, NameError): _ = lambda x: x def red(text): return Fore.RED + Style.BRIGHT + text def blue(text): return Fore.BLUE + Style.BRIGHT + text def cyan(text): return Fore.CYAN + Style.BRIGHT + text
# transfert.ssh.scplocalboot(myhost.mac) if 'lin' in os['nom_os'].lower(): if os['nom_idb'] == '/': l = pyddlaj.linux_host.LinuxHost(os['dev_path']) l.rename(myhost.dns) l.cleanUdev() l.installGrub() return reboot() if __name__ == '__main__': os.environ['LANG'] = settings.LANG; os.environ['LOCPATH'] = os.path.dirname(languages.__file__) _ = initialize('pyddlaj_client') exit_code = 0 jdb = pyddlaj.db.jeddlajdb(settings.MYSQL_HOST, settings.MYSQL_USER, settings.MYSQL_PASSWORD, settings.MYSQL_DB, 3306) myhost = pyddlaj.host.host() print '************************************************' print _('system detection') print _('mac:') , myhost.mac # print _('uname:'), myhost.uname print _('ip:'), myhost.ip # print _('proc:'), myhost.proc print _('machine : ') , myhost.machine print _('dns :'), myhost.dns print '**********************************************'
jdb.addTaskHost(tid, dbhost['nom_dns']) print _("Adding host to task ID " + str(tid)) else: jdb.setState(dbhost['nom_dns'], state) #All action require remove of local boot from the tftp server transfert.removeLocalBoot(dbhost['adresse_mac']) if __name__ == '__main__': os.environ['LANG'] = settings.LANG; os.environ['LOCPATH'] = os.path.dirname(languages.__file__) _ = initialize('changestate') enstate = ["osdeploy","osbackup","rename","reboot","debug"] frstate = ["deploieidb","idb","renomme","reboot","depannage"] if len(sys.argv) !=3 or (sys.argv[2] not in enstate and sys.argv[2] not in frstate): print _("Usage : changestate hostname newstate") print _("newstate must be one of : osdeploy,osbackup,rename,reboot,debug") sys.exit(1) if (sys.argv[2] in enstate): idx = enstate.index(sys.argv[2]) state = frstate[idx] else: state = sys.argv[2] pp= pprint.PrettyPrinter()
import os from colorama import Fore, Style from pkg_resources import resource_filename try: from flufl.i18n import initialize except ImportError: pass __all__ = ['_', 'LevelFormatter'] try: os.environ['LOCPATH'] = resource_filename(__name__, 'share') _ = initialize('intellicoder') except (KeyError, NameError): _ = lambda x: x def green(text, **kwargs): return color(text, Fore.GREEN, **kwargs) def yellow(text, **kwargs): return color(text, Fore.YELLOW, **kwargs) def red(text, **kwargs): return color(text, Fore.RED, **kwargs)
import re import string from flufl.i18n import initialize import os _ = initialize('pwtools') class PasswordChecker: # Failure reasons import pdb; pdb.set_trace() ReasonSame = _(u"the same as the old one") ReasonSimilar = _(u"based on the old one") ReasonShort = _(u"too short") ReasonLong = _(u"too long") ReasonSimpleShort = _(u"too simple for this length (not enough different kinds of characters, and too short)") ReasonSimple = _(u"too simple (not enough different kinds of characters)") ReasonPersonal = _(u"based on personal information") ReasonWord = _(u"based on a dictionary word") ReasonSeq = _(u"based on a common sequence of characters") def __init__(self, dictionary='/usr/share/dict/words'): """Create a new PasswordChecker object; takes an optional dictionary filename argument, which defaults to '/usr/share/dict/words'.""" self.deLeet = string.maketrans('@483!|10$5+7', 'aabeillosstt') self.charSetLengths = [10, 36, 62, 95] self.minLengths = [None, 12, 8, 7] self.minWords = 3 self.minPassphraseLen = 11 self.matchLength = 4 self.maxLength = None
server.listen(5) while True: conn, address = server.accept() thread = threading.Thread(target=handle_client, args=[conn]) thread.daemon = True thread.start() #with daemon.DaemonContext(): print "yoyo" serve_forever()""" # Echo server program #import socket os.environ['LANG'] = settings.LANG; os.environ['LOCPATH'] = os.path.dirname(languages.__file__) _ = initialize('pyddlajd') print _("Testing Database connection") jdb = pyddlaj.db.jeddlajdb(settings.MYSQL_HOST,settings.MYSQL_USER,settings.MYSQL_PASSWORD,settings.MYSQL_DB,3306) if jdb == None: print 'Error on DB connection. Please check your configuration in /etc/pyddlaj/pyddlaj.conf' exit(1) jdb.close() print _('Waiting for task to launch') HOST = '' # Symbolic name meaning all available interfaces PORT = settings.PYDDLAD_PORT # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(5) while 1:
import re import string from flufl.i18n import initialize import os _ = initialize("pwtools") class PasswordChecker: # Failure reasons import pdb pdb.set_trace() ReasonSame = _(u"the same as the old one") ReasonSimilar = _(u"based on the old one") ReasonShort = _(u"too short") ReasonLong = _(u"too long") ReasonSimpleShort = _(u"too simple for this length (not enough different kinds of characters, and too short)") ReasonSimple = _(u"too simple (not enough different kinds of characters)") ReasonPersonal = _(u"based on personal information") ReasonWord = _(u"based on a dictionary word") ReasonSeq = _(u"based on a common sequence of characters") def __init__(self, dictionary="/usr/share/dict/words"): """Create a new PasswordChecker object; takes an optional dictionary filename argument, which defaults to '/usr/share/dict/words'.""" self.deLeet = string.maketrans("@483!|10$5+7", "aabeillosstt") self.charSetLengths = [10, 36, 62, 95] self.minLengths = [None, 12, 8, 7] self.minWords = 3 self.minPassphraseLen = 11