Install Telegram desktop client for linux (x64).

    More infos:
      https://telegram.org
      https://desktop.telegram.org/
977291
def telegram():
    '''
    '''
    if not exists('~/bin/Telegram', msg='Download and install Telegram:'):
        run('mkdir -p /tmp/telegram')
        run('cd /tmp/telegram  &&  wget https://telegram.org/dl/desktop/linux')
        run('cd /tmp/telegram  &&  tar xf linux')
        with warn_only():
            run('mv /tmp/telegram/Telegram  ~/bin')
        run('rm -rf /tmp/telegram')
    else:
        print('skip download, dir ~/bin/Telegram already exists')
    run('ln -snf ~/bin/Telegram/Telegram  ~/bin/telegram',
            msg="\nCreate executable 'telegram':")
1215251
async def call(self,
                   method: Text,
                   _ignore: Set[Text] = None,
                   **params: Any):
        

        logger.debug('Calling Telegram %s(%s)', method, params)

        url = self.make_url(method)

        headers = {
            'content-type': 'application/json',
        }

        post = self.session.post(
            url,
            data=ujson.dumps(params),
            headers=headers,
        )

        async with post as r:
            out = await self._handle_telegram_response(r, _ignore)
            logger.debug('Telegram replied: %s', out)
            return out
904058
async def terminal(self, device):
        
        device = self._find_device(device)
        if not device.is_mounted:
            self._log.error(_("not opening terminal {0}: not mounted", device))
            return False
        if not self._terminal:
            self._log.error(_("not opening terminal {0}: no program", device))
            return False
        self._log.debug(_('opening {0} on {0.mount_paths[0]}', device))
        self._terminal(device.mount_paths[0])
        self._log.info(_('opened {0} on {0.mount_paths[0]}', device))
        return True
230012
def _mod_bufsize_linux(iface, *args, **kwargs):
    '''
    
    '''
    ret = {'result': False,
           'comment': 'Requires rx=<val> tx==<val> rx-mini=<val> and/or rx-jumbo=<val>'}
    cmd = '/sbin/ethtool -G ' + iface
    if not kwargs:
        return ret
    if args:
        ret['comment'] = 'Unknown arguments: ' + ' '.join([six.text_type(item)
                                                           for item in args])
        return ret
    eargs = ''
    for kw in ['rx', 'tx', 'rx-mini', 'rx-jumbo']:
        value = kwargs.get(kw)
        if value is not None:
            eargs += ' ' + kw + ' ' + six.text_type(value)
    if not eargs:
        return ret
    cmd += eargs
    out = __salt__['cmd.run'](cmd)
    if out:
        ret['comment'] = out
    else:
        ret['comment'] = eargs.strip()
        ret['result'] = True
    return ret
543618
def set_desktop_for_window(self, window, desktop):
        
        _libxdo.xdo_set_desktop_for_window(self._xdo, window, desktop)
1367777
def install(
    board_id='atmega88',
    mcu='atmega88',
    f_cpu=20000000,
    upload='usbasp',
    core='arduino',
    replace_existing=True,
):
    """"""

    board = AutoBunch()
    board.name = TEMPL.format(mcu=mcu, f_cpu=f_cpu, upload=upload)

    board.upload.using = upload
    board.upload.maximum_size = 8 * 1024

    board.build.mcu = mcu
    board.build.f_cpu = str(f_cpu) + 'L'
    board.build.core = core

    # for 1.0
    board.build.variant = 'standard'

    install_board(board_id, board, replace_existing=replace_existing)
931567
def send_image(path, refer, &callback)
      if @type == 'encr_chat'
        logger.warn("Currently telegram-cli has a bug with send_typing, then prevent this for safety")
        return
      end
      fail_back(&callback) if not File.exist?(path)
      @client.send_photo(targetize, path, &callback)
    end
1191563
public function TShopAuskunftAPI()
    {
        //
        if (!($this->parser = xml_parser_create())) {
            die('Cannot create parser');
        }

        xml_set_object($this->parser, $this);
        xml_set_element_handler($this->parser, 'start_tag', 'end_tag');
        xml_set_character_data_handler($this->parser, 'tag_contents');
    }
337272
function _initShell()
    {
        // connect using the sample parameters in protocol-1.5.txt.
        // according to wikipedia.org's entry on text terminals, "the fundamental type of application running on a text
        // terminal is a command line interpreter or shell".  thus, opening a terminal session to run the shell.
        $data = pack('CNa*N4C', NET_SSH1_CMSG_REQUEST_PTY, strlen('vt100'), 'vt100', 24, 80, 0, 0, self::TTY_OP_END);

        if (!$this->_send_binary_packet($data)) {
            user_error('Error sending SSH_CMSG_REQUEST_PTY');
            return false;
        }

        $response = $this->_get_binary_packet();

        if ($response === true) {
            return false;
        }
        if ($response[self::RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) {
            user_error('Expected SSH_SMSG_SUCCESS');
            return false;
        }

        $data = pack('C', NET_SSH1_CMSG_EXEC_SHELL);

        if (!$this->_send_binary_packet($data)) {
            user_error('Error sending SSH_CMSG_EXEC_SHELL');
            return false;
        }

        $this->bitmap |= self::MASK_SHELL;

        //stream_set_blocking($this->fsock, 0);

        return true;
    }
1204812
def send_telegram(telegram=None, client_key=None, tgid=None, key=None): # pragma: no cover
        
        if telegram:
            pass
        else:
            telegram = self.api_mother.telegram(client_key, tgid, key)
        telegram.send_telegram(self.nation_name)
111834
def get(self, request, bot_id, id, format=None):
                
        return super(TelegramChatStateDetail, self).get(request, bot_id, id, format)
872178
def notify(title, message, retcode=None):
    """"""
    if not path.exists(config_file):
        if not path.exists(config_dir):
            makedirs(config_dir)
        print("Follow the instructions to configure the Telegram backend.\n")
        configure(config_file)
    send(messages=[message], conf=config_file)
117071
function terminal(devicePath, exitCallback) {
  if (!args.quiet) log("Connecting to '"+devicePath+"'");
  var hadCtrlC = false;
  var hadCR = false;
  var ideServer = undefined;
  process.stdin.setRawMode(true);
  Espruino.Core.Serial.startListening(function(data) {
    data = new Uint8Array(data);
    var dataStr = String.fromCharCode.apply(null, data);
    if (ideServer) ideServer.write(dataStr);

    process.stdout.write(dataStr);
    /* If Espruino responds after a Ctrl-C with anything other
     than a blank prompt, make sure the next Ctrl-C will exit */
    for (var i=0;i<data.length;i++) {
      var ch = data[i];
      if (ch==8) hadCR = true;
      else {
        if (hadCtrlC && (ch!=62 /*>*/ || !hadCR)) {
          //process.stdout.write("\nCTRLC RESET BECAUSE OF "+JSON.stringify(String.fromCharCode.apply(null, data))+"  "+hadCR+" "+ch+"\n");
          hadCtrlC = false;
        }
        hadCR = false;
      }
    }
  });
  Espruino.Core.Serial.open(devicePath, function(status) {
    if (status === undefined) {
      console.error("Unable to connect!");
      return exitCallback();
    }
    if (!args.quiet) log("Connected");
    process.stdin.on('readable', function() {
      var chunk = process.stdin.read();
      if (chunk !== null) {
        chunk = chunk.toString();
        Espruino.Core.Serial.write(chunk);
        // Check for two Ctrl-C in a row (without Espruino doing anything inbetween)
        for (var i=0;i<chunk.length;i++) {
          var ch = chunk.charCodeAt(i);
          if (ch==3) {
            if (hadCtrlC) {
              process.stdout.write("\r\n");
              exitCallback();
            } else {
              // if we had ctrl-c, but didn't receive anything
              setTimeout(function() {
                if (hadCtrlC) process.stdout.write("\nPress Ctrl-C again to exit\n>");
              }, 200);
            }
            hadCtrlC = true;
          }
        }
      }
    });
    process.stdin.on('end', function() {
      console.log("STDIN ended. exiting...");
      exitCallback();
    });

    if (args.ideServer)
      ideServer = startWebIDEServer(function(data) {
        Espruino.Core.Serial.write(data);
      });

    // figure out what code we need to send (if any)
    sendCode(function() {
      if (args.watchFile) sendOnFileChanged();
    });

   }, function() {
     log("\nDisconnected.");
     exitCallback();
   });
}
628661
protected function loadDrivers()
    {
        DriverManager::loadDriver(TelegramDriver::class);
        DriverManager::loadDriver(TelegramAudioDriver::class);
        DriverManager::loadDriver(TelegramFileDriver::class);
        DriverManager::loadDriver(TelegramLocationDriver::class);
        DriverManager::loadDriver(TelegramContactDriver::class);
        DriverManager::loadDriver(TelegramPhotoDriver::class);
        DriverManager::loadDriver(TelegramVideoDriver::class);
    }
438448
def slave_open(tty_name):
    """"""

    result = os.open(tty_name, os.O_RDWR)
    try:
        from fcntl import ioctl, I_PUSH
    except ImportError:
        return result
    try:
        ioctl(result, I_PUSH, "ptem")
        ioctl(result, I_PUSH, "ldterm")
    except OSError:
        pass
    return result
626597
public function addCommand($command)
    {
        if (!is_object($command)) {
            if (!class_exists($command)) {
                throw new TelegramSDKException(
                    sprintf(
                        'Command class "%s" not found! Please make sure the class exists.',
                        $command
                    )
                );
            }

            if ($this->telegram->hasContainer()) {
                $command = $this->buildDependencyInjectedAnswer($command);
            } else {
                $command = new $command();
            }
        }

        if ($command instanceof CommandInterface) {

            /*
             * At this stage we definitely have a proper command to use.
             *
             * @var Command $command
             */
            $this->commands[$command->getName()] = $command;

            $aliases = $command->getAliases();

            if (empty($aliases)) {
                return $this;
            }

            foreach ($command->getAliases() as $alias) {
                if (isset($this->commands[$alias])) {
                    throw new TelegramSDKException(sprintf(
                        '[Error] Alias [%s] conflicts with command name of "%s" try with another name or remove this alias from the list.',
                        $alias,
                        get_class($command)
                    ));
                }

                if (isset($this->commandAliases[$alias])) {
                    throw new TelegramSDKException(sprintf(
                        '[Error] Alias [%s] conflicts with another command\'s alias list: "%s", try with another name or remove this alias from the list.',
                        $alias,
                        get_class($command)
                    ));
                }

                $this->commandAliases[$alias] = $command;
            }

            return $this;
        }

        throw new TelegramSDKException(
            sprintf(
                'Command class "%s" should be an instance of "Telegram\Bot\Commands\CommandInterface"',
                get_class($command)
            )
        );
    }
122349
public function boot()
    {
        if (! $this->isRunningInBotManStudio()) {
            $this->loadDrivers();

            $this->publishes([
                __DIR__.'/../../stubs/telegram.php' => config_path('botman/telegram.php'),
            ]);

            $this->mergeConfigFrom(__DIR__.'/../../stubs/telegram.php', 'botman.telegram');

            $this->commands([
                TelegramRegisterCommand::class,
            ]);
        }
    }