This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void epoll_server() | |
{ | |
for(; ;) { | |
nfds = epoll_wait(epfd, events, 20/*maxevents*/, 500/*timeout*/); | |
for(i = 0; i < nfds; ++i) { | |
// 如果是主socket的事件,则表示有新的连接 | |
if (events[i].data.fd == listenfd) { | |
connfd = accept(listenfd, | |
(sockaddr *) &clientaddr, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def complex_dft(xr, xi, n): | |
pi = 3.141592653589793 | |
rex = [0] * n | |
imx = [0] * n | |
for k in range(0, n): # exclude n | |
rex[k] = 0 | |
imx[k] = 0 | |
for k in range(0, n): # for each value in freq domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# calculator by call (bash)shell command. | |
calc=$(shell echo $$\(\($(1)\)\)) | |
foo=$(call calc,3*4) | |
SZ_1K:=$(call calc,32*32) | |
SZ_4K:=$(call calc,$(SZ_1K)*4) | |
SZ_4M:=$(call calc,$(SZ_4K)*$(SZ_1K)) | |
SZ_4G:=$(call calc,$(SZ_4M)*$(SZ_1K)) |