描述 | 扩展名 | Magic Number |
---|---|---|
Adobe Illustrator | .ai | 25 50 44 46 [%PDF] |
Bitmap graphic | .bmp | 42 4D [BM] |
Class File | .class | CA FE BA BE |
JPEG graphic file | .jpg | FF D8 |
JPEG 2000 graphic file | .jp2 | 0000000C6A5020200D0A [....jP..] |
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
/** | |
* Returns SHA-256 hash from supplied message. | |
* | |
* @param {String} message. | |
* @returns {String} hash as hex string. | |
* | |
* @example | |
* sha256('abc').then(hash => console.log(hash)); | |
* const hash = await sha256('abc'); | |
*/ |
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 fs from 'fs' | |
import glob from 'glob' | |
import cliProgress from 'cli-progress' | |
import getThemeColor from './main' | |
import ProHub from './prohub' | |
const [path] = process.argv.slice(2) | |
const bar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic) | |
glob(path, function (err, matches) { |
描述 | 扩展名 | Magic Number | |
---|---|---|---|
Adobe Illustrator | .ai | 25 50 44 46 [%PDF] | |
Bitmap graphic | .bmp | 42 4D [BM] | |
Class File | .class | CA FE BA BE | |
JPEG graphic file | .jpg | FF D8 | |
JPEG 2000 graphic file | .jp2 | 0 |
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
type Job<T> = () => Promise<T> | |
export const promiseThrottle = async <T>( | |
jobs: Job<T>[], | |
parallelCount: number, | |
onParallelDone?: (results: T[], index: number) => void | |
): Promise<T[]> => { | |
if (!(jobs && Array.isArray(jobs))) { | |
return Promise.reject('jobs must be Array') | |
} |
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 * as crypto from 'crypto' | |
const HMAC_ALGORITHM = 'HmacSHA1' | |
const ekey = Buffer.from('9527') | |
const ikey = Buffer.from('2840') | |
const mergeBytes = (...args: Uint8Array[]) => { | |
return Buffer.concat(args) | |
} |
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
Installing CYGWIN with SSH | |
1) Download cygwin setup.exe from http://www.cygwin.com | |
- Execute setup.exe | |
- Install from internet | |
- Root directory: `c:\cygwin` + all users | |
- Local package directory: use default value | |
- Select a mirror to download files from | |
- Select these packages: | |
- editors > xemacs 21.4.22-1 | |
- net > openssh 6.1-p |
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 memoize from 'lodash/memoize'; | |
const supportLocaleCompare = typeof String.prototype.localeCompare === 'function'; | |
const getShengmu = memoize((c: string) => { | |
const MAP = 'abcdefghjklmnopqrstwxyz'; | |
const boundaryChar = '驁簿錯鵽樲鰒餜靃攟鬠纙鞪黁漚曝裠鶸蜶籜鶩鑂韻糳'; | |
if (!supportLocaleCompare) { | |
return c; | |
} |
- n^2
- 在 UTF-8 编码规范中,8 个 character 组成的编号代表一个 byte,每个 character 以 0 或 1 表示。string 是一组 byte 或 character。 一个字符以 8 个 byte character 代表。 Unicode 是一种文字编码方案,目的是为了统一表示全球所有文字符号。UTF-8, UTF-16, GB2312 和 GB18030 是 Unicode 的几个具体实现
- iOS/MacOS
- iOS 下的微信,在登录了电脑版后,没有一个智能判断用户目前在哪个设备上活跃,而把消息通知只发到那个平台上
- iOS 下的 Twitter,没有浏览记录,如果回想起某条推文很难再找到
NewerOlder