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
####################################################################### | |
# Path: ~/.Xmodmap # | |
# Feature: switch Caps and Ctrl key with Debian & Ubuntu X enviroment # | |
####################################################################### | |
remove Lock = Caps_Lock | |
remove Control = Control_L | |
keysym Control_L = Caps_Lock | |
keysym Caps_Lock = Control_L | |
add Lock = Caps_Lock |
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
m = 20 | |
def compute_divisor(num): | |
line = ['-' for i in range(0, 20)] | |
ret = [] | |
for _ in range(0, num): | |
if _ == 0: pass | |
elif num % _ == 0: | |
ret.append(_) |
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
// APUE.Chapter.8 | |
// fork(), exec(), wait() | |
// Michael.Fan | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <sys/wait.h> | |
int main () | |
{ |
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
#pragma once | |
#include <boost/noncopyable.hpp> | |
#include <boost/beast/websocket.hpp> | |
#include <boost/beast/websocket/ssl.hpp> | |
struct websocket_stream : boost::noncopyable |
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
# py27 | |
import os | |
import sys | |
import logging | |
class EvenLogger(logging.Logger): | |
from logging import NOTSET | |
def __init__(self, name, level=NOTSET): |
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
/* | |
## ref | |
https://www.cnblogs.com/miloyip/archive/2010/06/23/cpp_vs_cs_GI.html | |
http://www.kevinbeason.com/smallpt/ | |
## build | |
g++ Miloyip-GL.cpp.cpp -lm | |
## run | |
```bash |
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 <memory> | |
using namespace std; | |
typedef unsigned char BYTE; | |
int M = 0xA5; | |
int A = 0xc9; | |
int N = 256; | |
int init = 0x55; |
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
// environment: C++14, gcc-11.2 | |
// build command: g++ -o ./boost_asio_ticker boost_asio_ticker.cpp -lpthread | |
#include <iostream> | |
#include <boost/asio.hpp> | |
#include <boost/bind/bind.hpp> | |
#include <chrono> | |
class Ticker { | |
public: |