V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  tomychen  ›  全部回复第 8 页 / 共 19 页
回复总数  377
1 ... 4  5  6  7  8  9  10  11  12  13 ... 19  
2020-12-18 14:06:07 +08:00
回复了 Livid 创建的主题 macOS macOS 下好用的 MySQL 工具 Sequel Ace 最近发布了一个大版本更新 3.0.0
这是 Sequel Pro 的新版吗?
2020-12-16 22:28:38 +08:00
回复了 JustinJie 创建的主题 NAS NAS 安全的使用方式
@JustinJie 你说的风险,我这统一归为“安全风险”来看待吧,我提过的 “现在的安全模式,可能在未来某个时间段就不安全了”。 涵盖的说法也是类似的说法, 小项目到底多小?风险评估又由谁来做呢?

或者简单的说,我放个纯 html 总不会有风险吧,好像没啥问题,但是 webserver 有了安全漏洞呢?(假定 nginx),当然,现在并没有,以后都不会有吗?

所以你说小项目会不会有风险?这是很难回答的一个问题。如果要想规避风险最直接的办法就是减少暴露,减少接触,但这中间又会牺牲到很多便利性,因为安全和方便永远是对立面的。所以这中间的成本就要你自己来评估,是安全重要,还是方便重要,再找一个相对的折中方案,就算完成一个“安全”方案了
2020-12-16 22:01:47 +08:00
回复了 BruceLe 创建的主题 程序员 吐槽 5 年经验年薪 20W+前端同事写的屎山代码
这大佬是 C 语言转过来的吧
2020-12-16 21:57:50 +08:00
回复了 JustinJie 创建的主题 NAS NAS 安全的使用方式
好像也就是 vpn 比较靠谱,改默认端口并不等于安全,被探测到只是时间问题,现在有很多全网扫描,很快就指纹识别到了,再者就是,现在安全的模式,可能在未来某个时间就不安全了。
所以能在内网里使用就在内网用吧,暴露的越少越安全。
2020-12-10 21:28:06 +08:00
回复了 fancy2020 创建的主题 Linux 关于 Linux 内存使用的一个疑问,大家帮忙看看
Private | Shared
1 | 2
Anonymous . stack |
. malloc() |
. brk()/sbrk() | . POSIX shm*
. mmap(PRIVATE, ANON) | . mmap(SHARED, ANON)
-----------------------+----------------------
. mmap(PRIVATE, fd) | . mmap(SHARED, fd)
File-backed . pgms/shared libs |
3 | 4

The following may help in interpreting process level memory values displayed as scalable columns and dis‐
cussed under topic `3a. DESCRIPTIONS of Fields'.

%MEM - simply RES divided by total physical memory
CODE - the `pgms' portion of quadrant 3
DATA - the entire quadrant 1 portion of VIRT plus all
explicit mmap file-backed pages of quadrant 3
RES - anything occupying physical memory which, beginning with
Linux-4.5, is the sum of the following three fields:
RSan - quadrant 1 pages, which include any
former quadrant 3 pages if modified
RSfd - quadrant 3 and quadrant 4 pages
RSsh - quadrant 2 pages
RSlk - subset of RES which cannot be swapped out (any quadrant)
SHR - subset of RES (excludes 1, includes all 2 & 4, some 3)
SWAP - potentially any quadrant except 4
USED - simply the sum of RES and SWAP
VIRT - everything in-use and/or reserved (all quadrants)


top 的计算方法还挺复杂
比较笼统的算,应该是 RES + SHR
2020-12-08 15:50:28 +08:00
回复了 weifan 创建的主题 Linux 目录加“/”和不加有什么区别呀?
难道不应该是 cd 的时候,shell 会直接把你输入的路径当成了目录,而在实际切换目录的时候发现不是目录才报错吗?

简单理解就是
cp -r /path/to/name .
的时候会把整个目录复制过来带,当前目录会多一个 name 目录,而
cp -r /path/to/name/ .
的时候则会把 /path/to/name/下的文件复制到当前位置并且当前目录无 name 目录,带 /和不带 / 就是告诉系统“作用”域在哪,加上 / 就是相当于 cd 到目录下 以 ./ 的形式操作。而无论什么时候,系统都会以最后一个 /作用作用目录。
2020-12-08 15:15:29 +08:00
回复了 xuerui911 创建的主题 Linux Linux 怎么实现 DHCP 和拨号上网同时使用?
@xuerui911 有个东西叫 VMware
2020-12-05 21:11:56 +08:00
回复了 xuerui911 创建的主题 Linux Linux 怎么实现 DHCP 和拨号上网同时使用?
这种需求不是电脑前面再加一个路由不就解决了么?或软或硬
2020-12-02 17:57:51 +08:00
回复了 firejoke 创建的主题 Linux Linux 的 ReusePort 特性
SO_REUSEPORT (since Linux 3.9)
Permits multiple AF_INET or AF_INET6 sockets to be bound to an identical socket address. This option must be set on each socket (including the first socket) prior to calling bind(2) on the
socket. To prevent port hijacking, all of the processes binding to the same address must have the same effective UID. This option can be employed with both TCP and UDP sockets.

For TCP sockets, this option allows accept(2) load distribution in a multi-threaded server to be improved by using a distinct listener socket for each thread. This provides improved load dis‐
tribution as compared to traditional techniques such using a single accept(2)ing thread that distributes connections, or having multiple threads that compete to accept(2) from the same socket.

For UDP sockets, the use of this option can provide better distribution of incoming datagrams to multiple processes (or threads) as compared to the traditional technique of having multiple
processes compete to receive datagrams on the same socket.


```c
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <string.h>
#include <netinet/in.h>
#include <unistd.h>

int main(void)
{
int sock = -1;
int flags = 1;
int ret;
struct sockaddr_in sa;

sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == -1) {
perror("socket");
return 1;
}
if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &flags, sizeof(int)) <
0) {
perror("setsockopt");
return 1;
}

memset(&sa, 0, sizeof(sa));

sa.sin_addr.s_addr = htonl(INADDR_ANY);
sa.sin_family = AF_INET;
sa.sin_port = htons(10086);

ret = bind(sock, (struct sockaddr *)&sa, sizeof(sa));
if (ret == -1) {
perror("bind()");
return 1;
}

ret = listen(sock, 10);
if (ret == -1) {
perror("listen()");
return 1;
}
while (1) {
printf("listen\n");
sleep(2);
}
}
```
uname -a
Linux localhost.localdomain 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

代码工作正常,所以和系统无关
2020-11-30 16:32:06 +08:00
回复了 chaleaoch 创建的主题 Linux socket 提供的 api 属于库函数还是系统调用?
SOCKET(2) BSD System Calls Manual SOCKET(2)

NAME
socket -- create an endpoint for communication

SYNOPSIS
#include <sys/socket.h>

int
socket(int domain, int type, int protocol);

DESCRIPTION



socket()->__sys_socket()-->sock_create()-->...new_inode()
2020-11-30 16:16:07 +08:00
回复了 ypfepwxn 创建的主题 Linux 想找一个超精简的 Linux
@linux40 有啥亮点,能说说?
2020-11-19 16:48:12 +08:00
回复了 tomychen 创建的主题 Linux 各位用 tmux 是习惯默认的 C-b 呢,还是自定义到其他键
C-x 还是有点怪怪的,而且 iterm2 在是会冲突的。

@anzu ssh 到远端的话,其实连按两次就响应为远端
2020-11-19 14:56:40 +08:00
回复了 tomychen 创建的主题 Linux 各位用 tmux 是习惯默认的 C-b 呢,还是自定义到其他键
@lcdtyph 这个要两只手了,就觉得不那么优雅了,哈哈...
2020-11-06 15:23:20 +08:00
回复了 jasonyang9 创建的主题 Linux firewalld 对 iptables 的 FORWARD 链是无法操作的?
nat 链优先级高于 filter 链,所以 input/output 无法阻断是对的
iptables 正常操作就是用 forward 链来控制,当然也有比较操蛋的做法就是用 post 或者 pre 里识别到-s 后,给丢到不存在的目标,也能达到效果

firewalld 没用过,但按理应该是可以的。
其实 linux 自带的很多工具可以完成,但说白了,有能力写代码的人,都想着自己实现一个符合自己工作习惯的一个工具,这没啥问题的。

screen / tmux / ~/.ssh/config
new_size = getfilesize()-16;// 自己实现
fread(data,size, oldfile);
fwrite(data, new_size,oldfile);//or newfile
说的不是 gentoo 吗
uid 改成 0 就行了
2020-07-06 19:09:38 +08:00
回复了 amrom 创建的主题 Linux Linux 防火墙关闭了,为什么还是可以访问
nat 的问题把 nat 也取消了
1 ... 4  5  6  7  8  9  10  11  12  13 ... 19  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3730 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 37ms · UTC 00:52 · PVG 08:52 · LAX 17:52 · JFK 20:52
Developed with CodeLauncher
♥ Do have faith in what you're doing.