This file contains hidden or 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
| # coding: utf-8 | |
| import turtle | |
| def draw_snake(rad, angle, length, neckrad): | |
| for i in range(length): | |
| # Draw a circle with given radius | |
| turtle.circle(rad, angle) | |
| turtle.circle(-rad, angle) | |
| turtle.circle(rad, angle / 2) |
This file contains hidden or 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
| // | |
| // main.cpp | |
| // timu | |
| // | |
| // Created by GuoChunyang on 16/2/26. | |
| // Copyright © 2016年 GuoChunyang. All rights reserved. | |
| // | |
| #include <iostream> | |
| #include <mutex> |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <ucontext.h> | |
| #include <unistd.h> | |
| int main(int argc, const char *argv[]) | |
| { | |
| ucontext_t context; | |
| getcontext(&context); | |
| puts("hello world\n"); |
This file contains hidden or 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
| /** | |
| * readn - 读取固定字节数 | |
| * @fd: 文件描述符 | |
| * @buf: 接收缓冲区 | |
| * @count: 要读取的字节数 | |
| * 成功返回count,失败返回-1,读到EOF返回<count | |
| */ | |
| ssize_t readn(int fd, void *buf, size_t count) | |
| { | |
| size_t nleft = count; |
This file contains hidden or 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
| # coding: utf-8 | |
| import types | |
| class Task(object): | |
| taskid = 0 | |
| def __init__(self, target): | |
| Task.taskid += 1 | |
| self.tid = Task.taskid |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <event2/event.h> | |
| #include <event2/buffer.h> | |
| #include <event2/bufferevent.h> | |
| #define MAX_LINE 1024 | |
| #define ERR_EXIT(m) \ |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <arpa/inet.h> | |
| #include <pthread.h> | |
| #include <event2/event.h> | |
| #include <event2/buffer.h> |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdint.h> | |
| #include <iostream> | |
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| //计算UTF8编码所占的字节 |