View sendmeta.c
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
//先解釋一下助教寫的login流程 | |
//csiebox_server.c:login() | |
info->conn_fd = conn_fd; | |
server->client[conn_fd] = info; //有關這個client的資料都存在這裡,例如家目錄 | |
header.res.status = CSIEBOX_PROTOCOL_STATUS_OK; | |
header.res.client_id = info->conn_fd; //把client_id送給client | |
//........ | |
send_message(conn_fd, &header, sizeof(header)); //送出,反正送用send_message,等資料用recv_message | |
View zombie.c
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
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
int main(int argc, const char *argv[]) | |
{ | |
int i; | |
pid_t pid; | |
if (argc != 2) { | |
fprintf(stderr, "Usage: zombie num\n"); |
View fifo.c
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
uint32_t working_thread = 0; | |
working_thread = htonl(check_working(global_server->pool)); //get working thread num | |
fd = open(global_server->arg.fifofile, O_WRONLY | O_NONBLOCK); | |
if (fd == -1) { | |
fprintf(stderr, "open fifo file fail\n"); | |
return; | |
} | |
write(fd, &working_thread, sizeof(uint32_t)); | |
close(fd); |
View text decode serialize
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
fn serialize(mut self, stream: &[u8]) -> &[u8] { | |
match self.encoding.name() { | |
"utf-8" | "utf-16be" | "utf-16le" if (!self.ignoreBOM && !self.BOMseen) => { | |
match stream.get(0) { | |
Some(token) => { | |
self.BOMseen = true; | |
if *token == 0xFEFF { | |
stream.slice_from(1) | |
} else { | |
stream |
View swap_list.c
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
#include <stdio.h> | |
#include <stddef.h> | |
typedef struct _List { | |
struct _List *next; | |
int val; | |
} List; | |
enum { | |
SWAPSUCCESS, |
View ClangQQ.c
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
#include <stdio.h> | |
int main(int argc, const char *argv[]) | |
{ | |
int n = 1; | |
// little endian if true | |
if(*(char *)&n == 1) | |
printf("Litt\n"); | |
else | |
printf("Big\n"); | |
signed int lval = 0xFEDCBA98 << 32; |
View dummysyscall.c
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
#include <linux/kernel.h> | |
#include <linux/init.h> | |
#include <linux/sched.h> | |
#include <linux/syscalls.h> | |
#include <uapi/linux/errno.h> | |
#include <asm/uaccess.h> | |
#include <linux/string.h> | |
#include <linux/list.h> | |
#include <linux/sched.h> |
View syscall_test.c
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
#include <stdio.h> | |
#include <linux/kernel.h> | |
#include <sys/syscall.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/wait.h> | |
#include "dummysyscall.h" |
View q1.cpp
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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
void peak(vector<vector<int>> &table, int row, int col) { | |
for (int i = 0; i < row; ++i) { | |
for (int j = 0; j < col; ++j) { | |
cout << table[i][j] << " "; |
View fish-not-in-net.html
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
<div data-fte="1" data-ftr="1" class="_5jmm _5pat _3lb4 g_yvbt0g4s4" id="hyperfeed_story_id_5bba1b28a1f901a21693682" data-testid="fbfeed_story" data-cursor="MTUzODkyMzMwMjoxNTM4OTIzMzAyOjM6LTkzNzU4OTg3MzMxMTUzNDQzNTowOjY2MDk2MjUyNTQ5NDU2MjkxMTY=" data-dedupekey="-937589873311534435" data-timestamp="1538644175" aria-posinset="3" aria-setsize="12" data-referrer="hyperfeed_story_id_5bba1b28a1f901a21693682" role="article" aria-labelledby="js_si" aria-describedby="js_sj js_sk" data-insertion-position="2"> | |
<div class="_4-u2 mbm _4mrt _5v3q _4-u8" id="u_jsonp_8_1"> | |
<div class="_3ccb" data-ft="{"tn":"-R"}" data-gt="{"type":"click2canvas","fbsource":703,"ref":"nf_generic"}" id="u_jsonp_8_2"> | |
<div></div> | |
<div></div> | |
<div class="_5pcr userContentWrapper" style="" data-ft="{"tn":"-R"}"> | |
<div class="_1dwg _1w_m _q7o"> | |
<div class="_4r_y" id="u_jsonp_8_ |
OlderNewer