mysql命令大全

2012-9-13 孤独求学人 Mysql

create database name; 创建数据库

use databasename; 选择数据库

drop database name 直接删除数据库,不提醒

show tables; 显示表

阅读全文>>

标签: mysql

评论(0) 浏览(14090)

Docker 那些事

2022-9-2 孤独求学人 docker

Docer 简介

Docker是基于Go语言实现的开源容器项目。它诞生于2013年年初,最初发起者是dotCloud公司。Docker自开源后受到业界广泛的关注和参与,目前已有80多个相关开源组件项目(包括Containerd、Moby、Swarm等),逐渐形成了围绕Docker容器的完整的生态体系。

Docker的构想是要实现“Build, Ship and Run Any App, Anywhere”,即通过对应用的封装(Packaging)、分发(Distribution)、部署(Deployment)、运行(Runtime)生命周期进行管理,达到应用组件级别的“一次封装,到处运行”。这里的应用组件,既可以是一个Web应用、一个编译环境,也可以是一套数据库平台服务,甚至是一个操作系统或集群。

Docker 解决的问题

由于不同的机器有不同的操作系统,以及不同的库和组件,在将一个应用部署到多台机器上需要进行大量的环境配置操作。

Docker 主要解决环境配置问题,它是一种虚拟化技术,对进程进行隔离,被隔离的进程独立于宿主操作系统和其它隔离的进程。使用 Docker 可以不修改应用程序代码,不需要开发人员学习特定环境下的技术,就能够将现有的应用程序部署在其它机器上。

Docker-kernel

Docker在开发和运维中的优势

  • 更快速的交付和部署
  • 更高效的资源利用
  • 更轻松的迁移和扩展
  • 更简单的更新管理

阅读全文>>

标签: docker

评论(0) 浏览(874)

欢迎您关注“刘善海价值分享”微信公众号!

2022-2-6 孤独求学人 Message

本公众号的初心是 “让企业管理者少走冤枉路”,使命是“让大家思想成就您的卓越与美好”,她旨在

①原汁原味地呈现一些管理大家、管理大师的思想,甚或是伟人的核心思想中对企业管理有深远意义和长远价值的部分;

②深度解析、解码、精炼一些经典思想,升级为更适合当下、更易于理解、更易于掌握的管理方法;

③分享一些企业高质量发展的案例。她把“成为您高质量发展道路上的忠信伙伴”作为愿景,并一以贯之地呈现出“激情-奉献-合作-感恩”的生命生态,从而让她的绵薄之力汇集到实现中华民族复兴的磅礴伟力中。

本公众号适合于各级企业管理者,它能为企业的高质量发展提供些思想理论基础和行动参考。

标签: 价值分享

评论(0) 浏览(463)

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):

2020-7-7 孤独求学人 Vue

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: ENOENT: no such file or directory, scandir '/Users/shiwei/Documents/admin-zeus/node_modules/node-sass/vendor'
    at Object.readdirSync (fs.js:785:3)
    at Object.getInstalledBinaries (/Users/shiwei/Documents/admin-zeus/node_modules/node-sass/lib/extensions.js:133:13)
    at foundBinariesList (/Users/shiwei/Documents/admin-zeus/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/Users/shiwei/Documents/admin-zeus/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/Users/shiwei/Documents/admin-zeus/node_modules/node-sass/lib/errors.js:45:5)
    at module.exports (/Users/shiwei/Documents/admin-zeus/node_modules/node-sass/lib/binding.js:15:30)
    at Object.<anonymous> (/Users/shiwei/Documents/admin-zeus/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at getDefaultSassImpl (/Users/shiwei/Documents/admin-zeus/node_modules/sass-loader/dist/index.js:198:10)
    at Object.loader (/Users/shiwei/Documents/admin-zeus/node_modules/sass-loader/dist/index.js:80:29)


使用npm install 安装模板后,没有报错

但是通过npm run dev 启动项目,报上面的错误

这个是因为node-sass没安装好,所以要重新安装
运行命令:npm install node-sass --registry=https://registry.npm.taobao.org

标签: install node-sass vu vue npm

评论(0) 浏览(2124)

Linux vim/vi下backspace(退格键)出现^? 或^H

2019-10-31 孤独求学人 Linux

当次删除操作,可以用【ctrl+w】以词为单位删除。一劳永逸的解决办法需按下面进行,二选一。

vim/vi下退格键出现^? (bash下)

方式一:
编辑 .bash_profile 文件,添加一行 stty erase ^? 到最后。执行如下:

vi ~/.bash_profile
stty erase ^?

方式二:
vim/vi下退格键出现^H(csh下)

编辑 .cshrc 文件,添加一行 stty erase ^H 到最后。执行如下:

vi ~/.cshrc
stty erase ^H


p.s.:bash下 检查修改是否成功,输入命令:

stty -a

发现值 erase = ^?; 已经修改成功。

标签: vim vi bash stty backspace

评论(0) 浏览(519)

python 如何通过subprocess.call调用自定义alias别名

2019-1-20 孤独求学人 Python

为了更好的通过Python脚本执行linux命令,通过自定义别名(Alias)进行多个命令组合,然而通过python中如何通过subprocess类库

自定义alias

#alias lt='ls --human-readable --size -1 -S --classify'
alias lt='du -sh * | sort -h'

测试调用的Python代码

from subprocess import call

def test():
    call("lt")

if __name__ == "__main__":
    test()

直接运行上面的代码提示错误信息如下

Traceback (most recent call last):
  File "test_alias.py", line 7, in <module>
    test()
  File "test_alias.py", line 4, in test
    call("lt")
  File "/Users/shiwei/anaconda3/lib/python3.7/subprocess.py", line 323, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/Users/shiwei/anaconda3/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/Users/shiwei/anaconda3/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'lt': 'lt'

通过错误信息可以看出lt命令被当作了文件或目录提示找不到

如果您需要的别名是在 ~/.bashrc 中定义的,可以通过尝试以下几种方式进行运行:

1)你必须给’shell’关键字:

subprocess.call('command', shell=True)

否则,您给定的命令用于查找可执行文件,而不是传递给 shell,它是扩展别名和函数等内容的 shell。

from subprocess import call

def test():
    call("lt", shell=True)

if __name__ == "__main__":
    test()

运行此处代码发现报错找不到文件或目录的错误了,但是出现了新的错误,错误信息如下

# /bin/sh: lt: command not found

有错误信息可以看出还是找不到lt命令,不过不报错误了(此处应该有掌声)

2) 默认情况下,subprocess.call 使用’/bin/sh’ shell。如果这是您要调用的 Bash 别名,则需要使用“可执行”关键字 告诉子进程使用 bash 而不是 sh:

subprocess.call('command', shell=True, executable='/bin/bash')

代码如下

from subprocess import call

def test():
    call("lt", shell=True, executable='/bin/bash')

if __name__ == "__main__":
    test()

通过执行代码发现,报错的错误同上,还是提示lt找到

3) 但是,/bin/bash 除非作为“交互式”shell(使用“-i”)启动,否则不会获取 ~/.bashrc。不幸的是,您不能传递 executable=’/bin/bash -i’,因为它认为整个值是可执行文件的名称。因此,如果您的别名是在用户的正常交互式启动中定义的,例如在 .bashrc 中,您必须使用以下替代形式调用命令:

subprocess.call(['/bin/bash', '-i', '-c', 命令])
# i.e. shell=False (the default)
from subprocess import call

def test():
    call(['/bin/bash', '-i', '-c', 'lt'])

if __name__ == "__main__":
    test()

正常执行,成功调用了alias命令

标签: python subprocess alias

评论(0) 浏览(376)

python2 python3中long类型的区别

2018-10-31 孤独求学人 Python

python2 python3中long类型的区别

python2中有long类型

python3中没有long类型,只有int类型

标签: python long

评论(0) 浏览(1271)

10 个 Linux 中方便的 Bash 别名

2018-10-10 孤独求学人 Linux

你有多少次在命令行上输入一个长命令,并希望有一种方法可以保存它以供日后使用?这就是 Bash 别名派上用场的地方。它们允许你将长而神秘的命令压缩为易于记忆和使用的东西。需要一些例子来帮助你入门吗?没问题!

要使用你创建的 Bash 别名,你需要将其添加到 .bash_profile 中,该文件位于你的家目录中。请注意,此文件是隐藏的,并只能从命令行访问。编辑此文件的最简单方法是使用 Vi 或 Nano 之类的东西。

1、 你有几次遇到需要解压 .tar 文件但无法记住所需的确切参数?别名可以帮助你!只需将以下内容添加到 .bash_profile 中,然后使用 untar FileName 解压缩任何 .tar 文件。

alias untar='tar -zxvf '
2、 想要下载的东西,但如果出现问题可以恢复吗?

alias wget='wget -c '

3、 是否需要为新的网络帐户生成随机的 20 个字符的密码?没问题。

alias getpass="openssl rand -base64 20"

阅读全文>>

标签: linux wget tar alias

评论(0) 浏览(1914)

'python' engine because the 'c' engine does not support regex separators

2018-10-2 孤独求学人 Python

moveielens.py:17: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex); you can avoid this warning by specifying engine='python'.
  user = pd.read_table(path1, sep='::', header=None, names=unames)

  pandas.read_table()函数,读取文件数据时,由于分隔符为'::',弹出如下警告
       警告:ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators (separators > 1 char and different from '\s+' are interpreted as regex)
       解决方法:增加函数的引擎参数engine='python',如下:

    user = pd.read_table(path1, sep='::', header=None, names=unames, engine='python')

阅读全文>>

标签: python pandas re read_table

评论(0) 浏览(3139)

importError c extension: No module named np_datetine not buit

2018-10-1 孤独求学人 Python

我的python代码中有

import pandas

使用pyinstaller进行打包exe的时候出现以下问题,现在就来说一下。
打包的时候没有报错,

但是执行时候首先报了pandas的错。提示没有找到pandas._lilbs.tslibs.np_datetime。大概的错误如下:

第一个错误是:

Fi1e sitepackagesp\pandas\init .py 1ine 35 in Kmodule?

importError c extension: No module named np_datetine not buit. Jf you yant to import pandas from. the source drectory

g you may need to run python setup. py buildext inplace force to bui1d the c extensions first:

iFai1ed to execute script smg



通过网上查找的方法,修改下pyinstaller的用法,生成过程中添加--hiddenimport=pandas._libs.tslibs.np_datetime,代码如下

pyinstaller -F -w smg.py  --hiddenimport=pandas._libs.tslibs.np_datetime

继续打包,过程中没有报错,继续执行exe文件的时候报错如下

第二个错误:
Fi1e sitepackagesp\pandas\init .py 1ine 35 in Kmodule?

Fi1e sitepackagesp\pandas\init .py 1ine 35 in Kmodule?

importError c extension: No module named timedeltas not buit. Jf you yant to import pandas from. the source drectory

g you may need to run python setup. py buildext inplace force to bui1d the c extensions first:

iFai1ed to execute script smg

iFai1ed to execute script smg

阅读全文>>

标签: pandas np_datetime timedeltas

评论(0) 浏览(2115)

Powered by emlog 豫ICP备15004178号-1