Skip to content

Instantly share code, notes, and snippets.

View ibreathebsb's full-sized avatar
🤠

Isaac Young ibreathebsb

🤠
View GitHub Profile
@ibreathebsb
ibreathebsb / serviceWorkerUpdate.js
Created April 8, 2018 10:03
serviceWorker update
/**
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ibreathebsb
ibreathebsb / NumberFlip.ts
Last active June 25, 2018 10:34
NumberFlip
// NumberFlip.ts
import * as React from 'react';
import cStyle from './NumberFlip.scss'
class NumberFlip extends React.Component {
private static Nums = Array.from({ length: 11 }).map((v, i) => i % 10);
private num: number = 0;
private $content: HTMLElement | null;
private $scroller: HTMLElement | null;
private height: number = 0;
// tree node
class TreeNode {
constructor(value) {
this.value = value
this.parent = null
this.left = this.right = null
}
insert(newNode) {
const {
value

SUID

  1. 只对二进制程序有效,对shell脚本或者目录无效
  2. 拥有者的权限执行位改为s
  3. 执行者拥有x权限
  4. 执行者在运行程序过程中将获得改文件拥有者的权限

SGID

which

在用户的目录($PATH)下查找指定的可执行文件

~ which ifconfig
/sbin/ifconfig

组成

  1. inode 用于记录文件的权限信息,以及对应的data block编号,每个文件占用一个inode
  2. data block 用于存放文件的内容,每个文件至少占用一个
  3. superblock 用于记录整个文件系统的inode block用量以及文件系统相关信息

索引式文件系统,inode和block都有自己的编号,可以根据inode直接获取所有data block 的编号并直接访问,访问效率高

filesystem = boot sector + block group * n

配置文件

cat /etc/fstab

# filesystem | mount point | type | mount option | dump | fsck
/dev/loop15 /snap/gnome-logs/37 squashfs ro,nodev,relatime 0 0
/dev/nvme0n1p1 /boot/efi vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/nvme0n1p2 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0

df

df 列出文件系统的使用情况 df /somepath 会自动匹配该目录对应的文件系统并列出该文件系统的使用情况

du

du 列出文件大小

tar

将多个文件打包为一个文件

命令

tar -c -f archive.tar files/directories 将文件或目录打包为一个文件

tar -[r|u] -f archive.tar newfiles/newdirectoreis 将新的文件添加到当前包中,只对非压缩的archive有效, u与r的不同之处在于,u=update只有目标文件比archive中对应的文件新时才会更新

gzip

gzip 用于压缩解压查看文件

用法: gzip [opitions] file

-v: 显示压缩和解压缩信息

-k: 压缩和解压时保留原来的文件