-
Computer system
- hardware
- CPU
- memory
- I/O devices
- operating system
- application programs
- users
- hardware
-
Computer system
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
(function CracklePop() { | |
for (let i = 1; i <= 100; i++) { | |
const div3 = i % 3; | |
const div5 = i % 5; | |
if (div3 === 0 && div5 === 0) { | |
console.log('CracklePop'); | |
} else if (div3 === 0) { | |
console.log('Crackle'); | |
} else if (div5 === 0) { | |
console.log('Pop'); |
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
async function get(url) { | |
urlArr = url.split('?'); | |
url = `${urlArr[0]}.json?${urlArr[1] || ''}` | |
const res = await fetch(url, { | |
method: 'GET', | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
mode: 'cors' | |
}); |
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
FROM php:7.1.4-fpm | |
RUN apt-get update && apt-get install -y \ | |
libfreetype6-dev \ | |
libjpeg62-turbo-dev \ | |
libmcrypt-dev \ | |
libpng-dev \ | |
libz-dev \ | |
&& docker-php-ext-install -j$(nproc) iconv mcrypt \ | |
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | |
&& docker-php-ext-install -j$(nproc) gd pdo pdo_mysql |
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> | |
void insert_sort(int arr[], int n) { | |
int tmp; | |
for (int i = 1; i < n; i++) { | |
int tmp = arr[i]; | |
for (int j = i - 1; j >= 0 && tmp < arr[j]; j--) { | |
arr[j+1] = arr[j]; | |
arr[j] = tmp; | |
} |
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 os | |
# Import all files in modules dynamically | |
for module in os.listdir(os.path.dirname(__file__)): | |
if module == '__init__.py' or module[-3:] != '.py': | |
continue | |
__import__(module[:-3], locals(), globals()) | |
del module |
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
function addEventHandler (target, type, func) { | |
if (target.addEventListener) { | |
target.addEventListener(type, func, false); | |
} else if (target.attachEvent) { | |
target.attachEvent('on' + type, func); | |
} else { | |
target['on' + type] = func; | |
} | |
} |
最近在看《操作系统概念》,第二章结束有个练习是给linux内核添加一个新的system call. 今天花了不少时间才完成,记录过程和遇到的坑。
环境:macOS sierra / CentOS7 3.10.0 in Parallels Desktop
一开始是打算直接对现有内核进行修改,但是修改之后发现现在系统中的内核不完整,缺少文件syscall_32.tbl,编译失败。于是从kernel.org下载新的完整的内核,我选择的版本是3.16.51.
之后的过程基本参考 https://tssurya.wordpress.com/2014/08/19/adding-a-hello-world-system-call-to-linux-kernel-3-16-0/
但是按照该过程安装完内核,重启,在grub引导界面选择新内核启动出现黑屏。网上查到的原因有:
- 显卡驱动缺失,需要重新安装parallels tools
NewerOlder