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
class SegmentTree: | |
def __init__(s_): | |
s_.segtree=[] | |
s_.lazytree=[] | |
s_.treelayer=0 | |
s_.capacity=0 | |
s_.datalength=0 | |
s_.compare=max | |
s_.firstleaf=0 | |
s_.numleafs=0 # alias to firstleaf |
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 <cstdlib> | |
#include <iomanip> | |
#include <queue> | |
#include <vector> | |
#include <algorithm> | |
#include <unordered_map> | |
#include <string> | |
using namespace std; |
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 <cstdlib> | |
#include <iomanip> | |
#include <queue> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
int LIMIT = 1e5; |
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 <string> | |
#include <utility> | |
using namespace std; | |
void ___m1(string* s, int lo, int hi){ | |
cout << "Let's sort! [" << lo << "," << hi << "] "; | |
for(int i=0;i<lo;i++) cout << (*s)[i]; | |
cout << "|"; |
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 socket | |
import time | |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
s.connect(('xxxxxxxx', 8080)) | |
s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) | |
s.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 35) | |
s.send(b'GET / HTTP/1.1\r\nHost: localhost') | |
data = s.recv(1024) | |
print(data) |
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 socket | |
import time | |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
s.connect(('127.0.0.1', 8080)) | |
time.sleep(1) | |
s.send(b'GET / HTTP/1.1\r\nHost: localhost') | |
data = s.recv(1024) | |
print(data) |
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 socket | |
QUEUELIMIT = 5 | |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
s.bind(('',8080)) | |
s.listen(QUEUELIMIT) | |
s.setsockopt(socket.SOL_TCP, socket.TCP_DEFER_ACCEPT, 1) | |
while True: | |
conn, addr = s.accept() |
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> //printf(), fprintf(), perror() | |
#include <sys/socket.h> //socket(), connect(), recv() | |
#include <arpa/inet.h> // struct sockaddr_in, struct sockaddr, inet_ntoa(), inet_aton() | |
#include <stdlib.h> //atoi(), exit(), EXIT_FAILURE, EXIT_SUCCESS | |
#include <string.h> //memset() | |
#include <unistd.h> //close(), sleep() | |
#include <linux/tcp.h> //TCP_DEFER_ACCEPT | |
#define MSGSIZE 32 | |
#define MAX_MSGSIZE 1024 |
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> //printf(), fprintf(), perror() | |
#include <sys/socket.h> //socket(), connect(), recv() | |
#include <arpa/inet.h> // struct sockaddr_in, struct sockaddr, inet_ntoa(), inet_aton() | |
#include <stdlib.h> //atoi(), exit(), EXIT_FAILURE, EXIT_SUCCESS | |
#include <string.h> //memset() | |
#include <unistd.h> //close() | |
#include <linux/tcp.h> //TCP_DEFER_ACCEPT | |
#include <time.h> // | |
#define MSGSIZE 32 |
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
#!/bin/bash | |
if [ -z "$*" ]; then | |
echo "cs [OPTIONS] DIR" | |
echo " ORDER BY OPTIONS:" | |
echo " -f : file count" | |
echo " -s : file size" | |
echo " -m : file modification time" | |
echo " -j : total size of files just under a directory" | |
echo " -a : total size of files all under a directory" |
NewerOlder