Skip to content

Instantly share code, notes, and snippets.

View jeasonstudio's full-sized avatar
:octocat:
Focusing

Jeason jeasonstudio

:octocat:
Focusing
View GitHub Profile
##############################################################################
# BASH CHEATSHEET (中文速查表) - by skywind (created on 2018/02/14)
# Version: 28, Last Modified: 2018/02/26 04:08
# https://github.com/skywind3000/awesome-cheatsheets
##############################################################################
##############################################################################
# 常用快捷键
##############################################################################

简述 JavaScript 中的 this

JS 中的 this 是一个相对复杂的概念, 不是简单几句能解释清楚的. 比较不负责任的说法是 this 的值取决于函数是如何调用的. 我阅读了网上很多关于 this 的文章, Arnav Aggrawal 写的比较清楚. this 取值符合以下规则:

  1. 通过 new 关键字调用函数, this 会是一个全新的 object
  2. 使用 apply, call 或者 bind 来调用/创建函数, this 的值取决于传入的第一个参数
  3. 如果函数作为对象的方法被调用, 比如 obj.method(), this 的值为该函数所作为属性的 object, 比如 obj
  4. 如果函数调用时不满足上述条件, 也就是 free function, this 的值为全局对象. 浏览器环境下是 window 对象, 但是在严格模式下('use strict'), this 的值为 undefined
  5. ES2015(ES6) 提出的箭头函数(Arrow function)不符合上述规则, 箭头函数 this 的值是该函数被 创建时 的作用域

Guideline of install docker

0x00 homebrew install

$ brew install docker docker-compose docker-machine xhyve docker-machine-driver-xhyve

0x01 try to use xhyve(instead of VBoxManage)

📚📚 Straw 📚📚

Straw 是一个在 macOS 系统下跨应用程序, 实现划词翻译的工作流(workflow).

Usage

  1. 打开 Automator, 选择新建一个 服务
  2. Service receives selectdtext, in any application
  3. 拖进来一个 Run Shell Script, Pass input 选择 stdin
  4. 把下面这段 shell 脚本粘进去
@jeasonstudio
jeasonstudio / mixins.md
Created January 28, 2018 11:13 — forked from justinfagnani/mixins.md
Maximally Minimal Mixins
@jeasonstudio
jeasonstudio / bilibili-dm.js
Created January 10, 2018 13:58
b 站弹幕姬 终端版本
const { Room } = require('bilibili-live')
const config = {
roomId: 30493,
url: 30493,
useWebsocket: true,
useWSS: true
}
const br = s => `\x1b[1m\x1b[31m${s}\x1b[0m`
@jeasonstudio
jeasonstudio / bilibili.sh
Last active July 29, 2023 19:32
Use FFmpeg rtmp streaming in macOS
#! /bin/bash
#
# Diffusion bilibili live avec ffmpeg
# Make sure you have FFmpeg installed in your mac
# list avfoundation devices
ffmpeg -f avfoundation -list_devices true -i ""
# change the param after `-i` and `-f flv`
IO8255_MODE EQU 28BH
IO8255_A EQU 288H
IO8255_B EQU 289H
IO8255_C EQU 28AH
CODE SEGMENT
ASSUME CS: CODE
START: MOV DX, IO8255_MODE ;8255初始化
MOV AL, 89H ; INPUT
OUT DX, AL
MOV AX, DATA
MOV DS, AX ; begin
MOV AH,1 ; read a character
INT 21H ; character gets put in AL
MOV AH, 2 ; write a character
MOV DL, AL ; ascii code goes in DL
INT 21H

如何将 大写锁定键 变为 Fn

0. 选择编程层
1. 将背面的开关3开启
2. 按一下 Fn
3. 按一下 大写锁定
4. 将背面的开关3关闭
结果为: 原来的 Fn 变为 win or cmd
原来的大写锁定键变为 Fn