Skip to content

Instantly share code, notes, and snippets.

@Chunlin-Li
Chunlin-Li / 2_keyboard_shortcuts.md
Last active August 1, 2016 04:40
Here are some things you can do with Gists in GistBox.

Create documentation for your projects. Like so:


Most popular keyboard shortcuts within GistBox

  • Up/Down - Previous/Next Gist
  • Ctrl+e - Edit a selected Gist
  • Ctrl+s - Save Gist
@Chunlin-Li
Chunlin-Li / pc
Last active July 31, 2016 14:49
xkb 配置文件 pc 和 us. 原路径 /usr/share/X11/xkb/symbols
default partial alphanumeric_keys modifier_keys
xkb_symbols "pc105" {
key <ESC> { [ Escape ] };
// The extra key on many European keyboards:
key <LSGT> { [ less, greater, bar, brokenbar ] };
// The following keys are common to all layouts.
key <BKSL> { [ backslash, bar ] };
@Chunlin-Li
Chunlin-Li / 1469273091275.md
Last active July 23, 2016 11:49
webstorm git integration combine multiple commit when push to remote. squash commit into one.

当前分支上, 本地已经有多个 commit 了. 此时想将这些零散的 commit 合并成一个.

context menu -> git -> repository -> rebase

勾选 interactive

onto 选定的是 remote 上对应当前本地分支的分支. 如 refs/remotes/origin/master

from 什么都不选

@Chunlin-Li
Chunlin-Li / cpu.md
Last active July 21, 2016 17:37
linux 系统下 修改 modify cpu pstate p-state cpufreq cpu freq turbo
@Chunlin-Li
Chunlin-Li / disKB.py
Last active July 21, 2016 16:59
用于自动识别外接键盘的插拔, 并完成笔记本内置键盘的停用和启用
#!/usr/bin/python
__author__ = 'jonny'
import re
import commands
import time
kbid_pattern = re.compile('(?<=id=)\d+', re.I)
masterid_pattern = re.compile('\d+(?=\)\])', re.I)
@Chunlin-Li
Chunlin-Li / 1466694521348.md
Last active June 23, 2016 15:53
send udp packet

echo -n "test message" | nc -4u -w1 [host] [udp port]

@Chunlin-Li
Chunlin-Li / alternative.yaml
Created June 22, 2016 06:36
rime fcitx config
# Rime alternative settings
# encoding: utf-8
#
# difference from default settings:
# 1. ascii-style punctuation in half-shape mode
# 2. [ ] as paging keys
#
# save this file as:
# (Linux) ~/.config/ibus/rime/alternative.yaml
# (Mac OS) ~/Library/Rime/alternative.yaml
@Chunlin-Li
Chunlin-Li / 11181118.md
Last active June 22, 2016 02:29
ubuntu linux manual set resolution. 手动添加分辨率

$ cvt 2048 1152 60.0
获取对应分辨率和刷新率的信息

# 2048x1152 @ 60.00 Hz (GTF) hsync: 71.52 kHz; pclk: 197.97 MHz Modeline "2048x1152_60.00" 197.00 2048 2184 2400 2752 1152 1155 1160 1195 -hsync +vsync

$ xrandr --newmode "2048x1152_60.00" 197.00 2048 2184 2400 2752 1152 1155 1160 1195 -hsync +vsync
使用第一步获得的信息, 创建新的 mode.

@Chunlin-Li
Chunlin-Li / 1464513169094.js
Created May 29, 2016 09:13
zlib_async_sync_test
'use strict';
const zlib = require('zlib');
const orgStr = 'Node is similar in design to, and influenced by, systems like Ruby\'s Event Machine or Python\'s Twisted. Node takes the event model a bit further, it presents an event loop as a runtime construct instead of as a library. In other systems there is always a blocking call to start the event-loop. Typically behavior is defined through callbacks at the beginning of a script and at the end starts a server through a blocking call like EventMachine::run(). In Node there is no such start-the-event-loop call. Node simply enters the event loop after executing the input script. Node exits the event loop when there are no more callbacks to perform. This behavior is like browser JavaScript — the event loop is hidden from the user.HTTP is a first class citizen in Node, designed with streaming and low latency in mind. This makes Node well suited for the foundation of a web library or framework.Just because Node is designed without threads, doesn\'t mean you canno
@Chunlin-Li
Chunlin-Li / cd98f00b204e.md
Last active May 18, 2016 11:58
linux / bash shell 中的命令

sort

排序

split

文件分割程序.