unix

MAC UNIX执行 CMD

帅比萌擦擦* 提交于 2020-02-17 02:07:32
在Solaris (Unix系统) 下,创建一个文件1.c 然后编辑1.c ,在1.c中添加如下代码 #include<stdlib.h> int main() { system("gedit"); //打开记事本 system(" ps -a"); //查看所有的进程 } [1]首先我们通过: cd /home/yincheng/ 桌面 进入1.c所在的目录位置 [2]然后我们通过: gcc 1.c 来编译 1.c文件生成一个a.out 文件 [3]再然后 通过 ./a.out 来运行生成的 a.out文件,打开记事本并且显示所有进程 2.在MAC系统下,同样能够运行ps –a命令, date命令(MAC是基于Unix基础和Solaris都是属于Unix),因此有很多的命令都是相同的 3.在MAC系统下,我们通过Xcode集成开发环境创建一个命令行项目,将其命名为GO 。 4.在GO项目的main.c文件中,我们添加两行代码: 第一行是包含头文件: #include<stdlib.h> 第二行是调用系统命令: system("ps -a"); 运行一下:打印出了所以正在运行的进程 (如红色框中所示) 5.修改system代码打开地图。 把system("ps -a"); 替换成 system("open /Applications/Maps.app"); 运行一下,打开地图 来源

I'm not able to get the Key attribute value from the JSON file using jq in shell [duplicate]

元气小坏坏 提交于 2020-02-16 13:17:24
问题 This question already has an answer here : Unable to fetch the JSON array values using jq in shell script (1 answer) Closed 5 months ago . I'm trying to get the Key from the below JSON file: I just executed the below command which will give the below JSON output Command: jq -r '.issues' Output: { "expand": "schema,names", "startAt": 0, "maxResults": 50, "total": 4, "issues": [{ "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "1999875", "self": "https:/

I'm not able to get the Key attribute value from the JSON file using jq in shell [duplicate]

[亡魂溺海] 提交于 2020-02-16 13:17:02
问题 This question already has an answer here : Unable to fetch the JSON array values using jq in shell script (1 answer) Closed 5 months ago . I'm trying to get the Key from the below JSON file: I just executed the below command which will give the below JSON output Command: jq -r '.issues' Output: { "expand": "schema,names", "startAt": 0, "maxResults": 50, "total": 4, "issues": [{ "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields", "id": "1999875", "self": "https:/

the-art-of-command-line 2019-02-15

末鹿安然 提交于 2020-02-15 18:38:02
命令行的艺术 前言 基础 日常使用 文件及数据处理 系统调试 单行脚本 冷门但有用 仅限 OS X 系统 仅限 Windows 系统 更多资源 免责声明 熟练使用命令行是一种常常被忽视,或被认为难以掌握的技能,但实际上,它会提高你作为工程师的灵活性以及生产力。本文是一份我在 Linux 上工作时,发现的一些命令行使用技巧的摘要。有些技巧非常基础,而另一些则相当复杂,甚至晦涩难懂。这篇文章并不长,但当你能够熟练掌握这里列出的所有技巧时,你就学会了很多关于命令行的东西了。 这篇文章是 许多作者和译者 共同的成果。 这里的部分内容 首次 出现 于 Quora , 但已经迁移到了 Github,并由众多高手做出了许多改进。 如果你在本文中发现了错误或者存在可以改善的地方,请 贡献你的一份力量 。 前言 涵盖范围: 这篇文章不仅能帮助刚接触命令行的新手,而且对具有经验的人也大有裨益。本文致力于做到 覆盖面广 (涉及所有重要的内容), 具体 (给出具体的最常用的例子),以及 简洁 (避免冗余的内容,或是可以在其他地方轻松查到的细枝末节)。在特定应用场景下,本文的内容属于基本功或者能帮助您节约大量的时间。 本文主要为 Linux 所写,但在 仅限 OS X 系统 章节和 仅限 Windows 系统 章节中也包含有对应操作系统的内容。除去这两个章节外,其它的内容大部分均可在其他类 Unix 系统或

使用socket方式连接Nginx优化php-fpm性能

丶灬走出姿态 提交于 2020-02-15 04:34:27
使用socket方式连接Nginx优化php-fpm性能 Nginx连接fastcgi的方式有2种:TCP和unix domain socket 什么是Unix domain socket?—— 维基百科 Unix domain socket 或者 IPC socket是一种终端,可以使同一台操作系统上的两个或多个进程进行数据通信。与管道相比,Unix domain sockets 既可以使用字节流和数据队列,而管道通信则只能通过字节流。Unix domain sockets的接口和Internet socket很像,但它不使用网络底层协议来通信。Unix domain socket 的功能是POSIX操作系统里的一种组件。 Unix domain sockets 使用系统文件的地址来作为自己的身份。它可以被系统进程引用。所以两个进程可以同时打开一个Unix domain sockets来进行通信。不过这种通信方式是发生在系统内核里而不会在网络里传播。 TCP和unix domain socket方式对比 TCP是使用TCP端口连接127.0.0.1:9000 Socket是使用unix domain socket连接套接字/dev/shm/php-cgi.sock( 很多教程使用路径/tmp,而路径/dev/shm是个tmpfs,速度比磁盘快得多 )

nginx和php-fpm调用方式

喜你入骨 提交于 2020-02-13 14:35:34
nginx和php-fpm调用方式 一.背景: 在开发中碰到一个问题,项目以nginx+php-fpm形式访问交互,结果访问项目时报错如下图: 二.分析: 提示很明确嘛,去看error.log(在nginx.conf或者vhost里头配置的,找到你对应路径即可) 错误信息如下: 1 2 3 2017/09/18 10:46:21 [error] 3880#0: *92 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.33.10, server: local.helios.com, request: "GET /v1/room/detail.json HTTP/1.1" , upstream: "fastcgi://127.0.0.1:9000" , host: "local.helios.com" 或 1 2 3 2017 /09/18 14:30:42 [crit] 5375 #0: *43 connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.33.10,

mysql对时间函数的处理 [转帖]

断了今生、忘了曾经 提交于 2020-02-12 15:40:53
昨天计费系统故障.电话挂断后TG给软件换发的消息bye丢失,造成homeserver一直等待直到超时;结果造成大量超长话单的产生。定位了一下午,后来才得知是TG的licence到期了,间断的停止服务。这时候需要处理对用户已经造成的损失。制订了以下方案: step1:退回已经扣除的巨额话费; step2:修正用户话单的结束时间和时长,重新计费 step3:对由此影响到的冻结用户解冻。 step4:向用户致谦 在step2的时候我使用了如下方式: update account_tbl set acct_timestamp=begin_timestamp+62,acct_timeduration=62 where acct_timeduration=10800; 想当然得认为是正确的,结果发现所有大话单的结束时间并没有修正到我预期的开始时间后延62s,而是变成'0000-00-00 00:00:00',这样奇怪的日期型在前台 表现层转换的时候引发异常所以读不出话单来。后来查找了mysql对时间的运算方式,发现我的方法acct_timestamp=begin_timestamp+62不 符合 mysql的语法 习惯。于是把关于时间处理的函数统计了一下。以下是收集到的资料: 这里是一个使用日期函数的例子。下面的查询选择了所有记录,其date_col的值是在最后30天以内: mysql>

前端性能监控

假装没事ソ 提交于 2020-02-12 10:29:39
最近在做关于前端性能监控的功能,花了点时间研究了一下。先放一张经典图: 因为是原图,有点大,要横着拉了看,上面这些标注的属性就是window.performance.timing下的属性,里面一些含义这边列举一下(参考MDN),默认都是毫秒数: navigationStart : 表征了从同一个浏览器上下文的上一个文档卸载(unload)结束时的UNIX时间戳。如果没有上一个文档,这个值会和PerformanceTiming.fetchStart相同。 unloadEventStart:表征了unload事件抛出时的UNIX时间戳。如果没有上一个文档,or if the previous document, or one of the needed redirects, is not of the same origin, 这个值会返回0. unloadEventEnd:表征了unload事件处理完成时的UNIX时间戳。如果没有上一个文档,or if the previous document, or one of the needed redirects, is not of the same origin, 这个值会返回0. redirectStart:表征了第一个HTTP重定向开始时的UNIX时间戳。如果没有重定向,或者重定向中的一个不同源,这个值会返回0.

Example Post - PCT的博客

六月ゝ 毕业季﹏ 提交于 2020-02-09 23:09:54
This document is not completed and will be updated anytime. Catagory Unix Bell Labs Xenix BSD FreeBSD & Apple NeXTStep Darwin POSIX Unix-like Single Unix Specification Apple iOS XNU Kernel Linux Linux Kernel GNU Project Android Android Kernel Android ROM Chrome OS Chromium OS Unix Unix is a family of multitasking, multiuser computer OS. Derive from the original AT&T Unix , Developed in the 1970s at Bell Labs (贝尔实验室), initially intended for use inside the Bell System . Bell Labs Bell 和 AT&A 在那时已经是一家了,可以看到那时的通信公司真是一线 IT 公司呢。 C 语言也是 Bell Labs 的产物 ,从一开始就是为了用于 Unix 而设计出来的。所以 Unix (在 73 年用 C 重写