Ubuntu

quickest way to select/copy lines containing string from huge txt.gz file

喜你入骨 提交于 2021-02-19 04:21:49
问题 So I have the following sed one liner: sed -e '/^S|/d' -e '/^T|/d' -e '/^#D=/d' -e '/^##/d' -e 's/H|/,H|/g' -e 's/Q|/,,Q|/g' -e '1 i\,,,' sample_1.txt > sample_2.txt I have many lines that start with either: S| T| #D= ## H| Q| The idea is to not copy the lines starting with one of the first fours and to replace H| (at the beginning of lines) by ,H| and Q| (at the beginning of lines) by ,,Q| But now I would need to: use the fastest way possible (internet suggests (m)awk is faster than sed)

quickest way to select/copy lines containing string from huge txt.gz file

随声附和 提交于 2021-02-19 04:21:25
问题 So I have the following sed one liner: sed -e '/^S|/d' -e '/^T|/d' -e '/^#D=/d' -e '/^##/d' -e 's/H|/,H|/g' -e 's/Q|/,,Q|/g' -e '1 i\,,,' sample_1.txt > sample_2.txt I have many lines that start with either: S| T| #D= ## H| Q| The idea is to not copy the lines starting with one of the first fours and to replace H| (at the beginning of lines) by ,H| and Q| (at the beginning of lines) by ,,Q| But now I would need to: use the fastest way possible (internet suggests (m)awk is faster than sed)

pip问题:ImportError: cannot import name main

China☆狼群 提交于 2021-02-19 01:50:22
问题描述 今天使用pip安装python包的时候,提示可以升级到最新版的pip,然后就升级了pip,从8.1.1到19.0.3,结果,就出现了下面的问题,pip不能用了: Traceback (most recent call last ): File " /usr/bin/pip " , line 9 , in <module> from pip import main ImportError: cannot import name main 环境:Ubuntu 16.04 原因 最后查到的原因是之前安装的pip是通过ubuntu的apt包管理工具安装的,也就是系统默认的pip,使用pip install --upgrade pip升级pip时,新安装的pip完全绕过了apt包管理工具,两者发生冲突引起的。 解决办法 1、从python卸载pip的更新; python -m pip uninstall pip 2、从apt中卸载pip包; apt remove python-pip 3、下载安装pip; wget https: // bootstrap.pypa.io/get-pip.py python get-pip.py 4、检查是否安装成功,执行pip --version,如果正常显示版本信息,则说明安装成功,如果此时报 -bash: /usr/bin/pip: No

Nginx (I think) saves files with wrong permissions when request is too large

£可爱£侵袭症+ 提交于 2021-02-18 23:00:26
问题 So, I'm completely new to hosting and Linux and all, so please forgive me if I'm saying things that are wrong. I'm still learning :) I'm working a small personal website created using Django. I wanted to get it online to see if everything would work. I got a cheap server from linode and using a guide from Digital-Ocean (the irony) I got everything working. I was happy. But... There's one major problem and I've read half the internet and can't find any similar problems: when the post request

Windows下fabric sdk连接Linux上fabric网络的调试过程

不打扰是莪最后的温柔 提交于 2021-02-18 20:59:36
上个月刚入职一家公司从事区块链研发工作,选型采用Hyperledger Fabric作为开发平台。团队的小组成员全部采用的是在VirtualBox上面安装桌面版的Ubuntu 16.04虚拟机,开发工具JetBrains GoLand也就直接在桌面版的虚拟机里面安装。而我因为之前比较习惯使用Vagrant + VirtualBox的方式快速加载我定制版的Ubuntu镜像从而创建Linux开发环境,这样一来的弊端就是我只能通过命令行来进行一切操作而没有桌面可操作,所以我的整个开发IDE就在本机的windows上进行。 我们的Fabric网络是采用的Docker方式启动,作为自己本地的测试环境自然就将网络搭建在Ubuntu虚拟机里面,前期由其它小组成员负责针对Go语言版本的SDK(Hyperledger子项目fabric-sdk-go)进行封装调用并利用Beego作为服务器将相应的API暴露出来,而我负责的便是将他们暴露出来的API进一步封装为标准Go版的SDK,所谓的标准就是对调用者而言无感是调用的区块链。这个时候问题就出现了,在我写SDK的过程中用单元测试对他们的API发起Http请求调用时一脸懵逼,观察Beego服务器打印的日志信息少的可怜几乎没有

Running Meteor Application on a Single Core

强颜欢笑 提交于 2021-02-18 18:56:21
问题 I am trying to run a meteor app on a remote host. The application works on my desktop, but when I run it on the remote host the meteor processes are either killed or they freeze. Here are a couple commands that are experiencing this issue: meteor meteor update meteor restart Each command is taking up about 99% of the cpu at the time of failure, so I suspect Ubuntu is killing the process. I believe that upgrading the CPU will fix these issues, but I want to get a second opinion before I buy

How do I downgrade my version of python from 3.7.5 to 3.6.5 on ubuntu

社会主义新天地 提交于 2021-02-18 18:47:54
问题 So currently, I have ubuntu 19. And it comes by default with python 3.7.5. I need to downgrade to 3.6.5. EDIT: I am using virtualenv 回答1: The following talks about upgrade from 3.6.7 to 3.7.0 but you can use the same process for downgrade. You should not change the system python unless you really know what you're doing First Install Pyenv Installlation Instructions are here Look at Pyenv Options $ pyenv pyenv 1.2.14 Usage: pyenv <command> [<args>] Some useful pyenv commands are: commands List

Unable to import cv2 and cvbridge in ROS and python3

我与影子孤独终老i 提交于 2021-02-18 18:02:57
问题 Environment Ubuntu 16.04 Python 3.5.2 Ros Distribution-Kinetic Ros was installed as per installation instruction ( sudo apt-get install ros-kinetic-full-desktop ) And to make the Python3 as default version, I followed the necessary and sufficient step of install python3 versions of rospkg and catkin( sudo pip3 install rospkg catkin_pkg ). After which i am able to import cv2 in python2 but not in python3 as below ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined

Unable to import cv2 and cvbridge in ROS and python3

穿精又带淫゛_ 提交于 2021-02-18 18:02:03
问题 Environment Ubuntu 16.04 Python 3.5.2 Ros Distribution-Kinetic Ros was installed as per installation instruction ( sudo apt-get install ros-kinetic-full-desktop ) And to make the Python3 as default version, I followed the necessary and sufficient step of install python3 versions of rospkg and catkin( sudo pip3 install rospkg catkin_pkg ). After which i am able to import cv2 in python2 but not in python3 as below ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined

MongoDB增删改查

前提是你 提交于 2021-02-18 17:40:28
一:启动mongodb 1、linux系统(Ubuntu):sudo server mongodb start 2、window系统:mongod,启动之后不能关闭cmd窗口,必须挂起 二:运行mongodb 命令:mongo 三、创建数据库 使用use 命令创建数据库----有就切换,没有就创建数据库 命令:use 数据库名 切换数据库 命令:use 数据库名 eg: 查看当前数据库: 查看所有数据库 销毁数据库 四:创建集合 在 MongoDB 中,一个数据库包含多个集合,类似于 MySQL 中一个数据库包含多个表;一个集合包含多个文档,类似于 MySQL 中一个表包含多条数据。 可以把集合记为表,文档记为一条记录。 命令:db.createcolleciton("school") 查看所有集合: 命令:show collections 五:插入数据 插入数据有两个命令 命令:db.school.insert() 命令:db.school.save() insert 和 save 的区别:为了方便记忆,可以先从字面上进行理解,insert 是插入,侧重于新增一个记录的含义;save 是保存,可以保存一个新的记录,也可以保存对一个记录的修改。因此,insert 不能插入一条已经存在的记录,如果已经有了一条记录(以主键为准),insert 操作会报错,而使用 save