Month: February 2018

Linux:SSH 无密码连接到 Google Cloud 实例, FileZilla连接 Google Cloud, IntelliJ IDEA连接 Google Cloud, google cloud compute instance, google cloud platform

1. 通过浏览器连接到实例 直接通过网络浏览器在 Google Cloud Platform 控制台中进行 SSH 连接: In the Cloud Platform Console, go to the VM Instances page.GO TO THE VM INSTANCES PAGE In the list of virtual machine instances, click SSH in the row of the instance that you want to connect to. 通过浏览器连接到实例时需要注意一些事项。如需了解详情,请参阅通过浏览器进行 SSH 连接。   2. 通过命令行连接到实例 您可以使用 gcloud 命令行工具轻松连接到您的… Read More

Shell: 无密码读写Mysql数据库, 无密码被分导出Mysql数据库, mysqldump , Connect to MySQL Without Root Password on Terminal

设置Mysql登录信息 How to Set MySQL Root Password 一般shell连接数据库的方法是: mysqladmin -u root password YOURNEWPASSWORD 无登录链接数据库的方法是创建或者修改 ~/.my.cnf 文件 Now create the config file ~/.my.cnf and add configurations below in it (remember to replace mysqluser and mysqlpasswd with your own values). [mysql] user=user password=password 如果你还是用了mysqldump,那么可… Read More

Linux: shell实现多线程, Forking / Multi-Threaded Processes | Bash, shell 线程池

按照shell语法,后一个前台命令必须等待前一个前台命令执行完毕才能进行,这就是所谓的单线程程序。如果两条命令之间有依赖性还好,否则后一条命令就白白浪费了等待的时间了。 网上查了一遍,shell并没有真正意义上的多进程。而最简单的节省时间,达到“多线程”效果的办法,是将前台命令变成后台进程,这样一来就可以跳过前台命令的限制了。 引用网上例子:   实例一:全前台进程: #!/bin/bash #filename:simple.sh starttime=$(date +%s) for ((i=0;i<5;i++));do { sleep 3;echo 1>>aa && endtime… Read More

Linux:cURL 命令详解,以及实例, curl auth, curl 模拟登陆,快速网站测压, curl 爬虫, curl Command Download File Example, How to quickly stress test a web server

  linux curl是一个利用URL规则在命令行下工作的文件传输工具。它支持文件的上传和下载,所以是综合传输工具,但按传统,习惯称url为下载工具。 一,curl命令参数,有好多我没有用过,也不知道翻译的对不对,如果有误的地方,还请指正。 -a/--append 上传文件时,附加到目标文件 -A/--user-agent <string> 设置用户代理发送给服务器 - anyauth 可以使用“任何”身份验证方法 -b/--cookie <name=string/file> cookie字符串或文件读取位置 - basic 使用HTTP基本验证 -B/--use-ascii 使用ASCII /文… Read More

Linux: SSH报错 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! 解决方案, Remove key from known_hosts, Fix Offending key in ~/.ssh/known_hosts file

  今天是用google cloud ssh登录的时候,发生以下报错: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It i… Read More

Linux: 命令行获取公共 IP 和 私有IP, How To Find My Public IP Address, Determine Your Private and Public IP Addresses, From Command Line On a Linux

  1. 命令行获取私有IP Use dig command for determining my public IP address: 打开 Terminal application. 输入以下命令行:Type the following dig (domain information groper) command on a Linux, OS X, or Unix-like operating systems to see your own public IP address assigned by the ISP: dig +short myip.opendns.com @resolver1.opendns.com 或者 dig TXT +short o-o.myaddr.l… Read More