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
| #!/usr/bin/env python3 | |
| import argparse | |
| from http.server import HTTPServer, SimpleHTTPRequestHandler | |
| import ssl | |
| def run(host, port, ctx, handler): | |
| server = HTTPServer((host, port), handler) | |
| server.socket = ctx.wrap_socket(server.socket) | |
| print('Server Starts - %s:%s' % (host, port)) |
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
| #!/usr/bin/env python3 | |
| import redis | |
| import json | |
| import argparse | |
| import sys | |
| def main(): | |
| parser = argparse.ArgumentParser( |
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
| #!/usr/bin/env python3 | |
| import argparse | |
| from http.server import HTTPServer, SimpleHTTPRequestHandler | |
| class CORSRequestHandler(SimpleHTTPRequestHandler): | |
| def end_headers(self): | |
| self.send_header('Cross-Origin-Opener-Policy', 'same-origin') | |
| self.send_header('Cross-Origin-Embedder-Policy', 'require-corp') | |
| self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate') |
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
| #!/usr/bin/env python3 | |
| import argparse | |
| import socketserver | |
| class MyUDPHandler(socketserver.BaseRequestHandler): | |
| def handle(self): | |
| data = self.request[0].strip() |
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 <time.h> | |
| #include <iomanip> | |
| #include <ios> | |
| #include <iostream> | |
| void print_timestamp(uint64_t tv_sec, uint64_t tv_nsec) { | |
| std::cout << std::setw(10) << tv_sec << "." << std::setfill('0') | |
| << std::setw(9) << tv_nsec << std::setfill(' ') << std::endl; | |
| } |
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 <iostream> | |
| #include <map> | |
| #include <set> | |
| #include <utility> | |
| #include <vector> | |
| template <typename T1, typename T2> | |
| std::ostream &operator<<(std::ostream &s, const std::pair<T1, T2> &p) { | |
| return s << "(" << p.first << ", " << p.second << ")"; | |
| } |
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
| #pragma once | |
| #include <cassert> | |
| #include <iostream> | |
| #include <memory> | |
| #include <sstream> | |
| #include <string> | |
| #include <unordered_map> | |
| namespace ArgPlus { |
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
| set term pdf | |
| set output "memory.pdf" | |
| set xlabel "time [sec]" | |
| set ylabel "free memory [byte]" | |
| set yrange [0:*] | |
| plot "memory.log" using 1:2 with lines title "memory" |
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 <chrono> | |
| #include <fstream> | |
| #include <iostream> | |
| #include <thread> | |
| int main(int argc, char* argv[]) { | |
| if (argc < 2) { | |
| std::cerr << "Usage: " << argv[0] << " " | |
| << "cpu_ratio" << std::endl; | |
| return 1; |
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
| global g_tmux_prefix_access_time := 0 | |
| GetCurrentTimeAsMilliSeconds() { | |
| millis := (a_hour * 3600 + a_min * 60 + a_sec) * 1000 + a_msec | |
| Return millis | |
| } | |
| IsTmuxAccess() { | |
| now := GetCurrentTimeAsMilliSeconds() | |
| sub := now - g_tmux_prefix_access_time |