Skip to content

Instantly share code, notes, and snippets.

View MrQianJinSi's full-sized avatar

MrQianjinsi MrQianJinSi

  • Beijing
View GitHub Profile
@MrQianJinSi
MrQianJinSi / Dockerfile
Last active January 22, 2021 14:07
Dockerfile for cpp project compilation
FROM ubuntu:18.04
ARG MINOR_VERSION=3.16
ARG VERSION=3.16.9
ARG ARCH=Linux-x86_64
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list\
&& apt update \
&& apt install -y g++ cmake vim wget \

VTable Notes on Multiple Inheritance in GCC C++ Compiler v4.0.1

http://www.cse.wustl.edu/~mdeters/seminar/fall2005/mi.html#basics

The Basics: Single Inheritance

As we discussed in class, single inheritance leads to an object layoutwith base class data laid out before derived class data. So if classes A and B are defined as:

+-------------+-------+
| publishdate | count |
+-------------+-------+
| 2019-01-31 | 52 |
| 2019-04-30 | 48 |
| 2019-04-27 | 34 |
| 2019-04-26 | 30 |
| 2019-07-24 | 24 |
| 2019-07-23 | 16 |
| 2019-04-29 | 12 |
@MrQianJinSi
MrQianJinSi / multiprocess_with_finalizer.py
Last active June 12, 2019 08:29
do cleanup work when sub-process exit
import multiprocessing as mp
from multiprocessing.util import Finalize
import os
import time
def finalizer():
time.sleep(0.2) # some time consuming work
print('do cleanup work: {}'.format(os.getpid()))
def worker(_):
@MrQianJinSi
MrQianJinSi / download_duokan.py
Created February 22, 2019 14:58
下载多看云空间中的书籍
import os
from urllib.parse import urljoin
import requests
def download_books(base_url, save_dir='books'):
file_url = urljoin(base_url, 'files')
res = requests.get(file_url)
book_metas = res.json()
if not os.path.exists(save_dir):
@MrQianJinSi
MrQianJinSi / linux_unusal_commands.sh
Last active February 22, 2019 15:00
linux下一些不太常见的操作
# 通过ssh挂载远程文件系统
sudo apt install sshfs
sudo mkdir /mnt/remotefs
sudo sshfs -o allow_other,IdentityFile=~/.ssh/id_rsa username@xxx.xxx.xxx.xxx:/path/of/remote /mnt/remotefs
## 卸载
sudo umount /mnt/remotefs