Skip to content

Instantly share code, notes, and snippets.

@Chunlin-Li
Chunlin-Li / 11031130.md
Created November 3, 2015 03:49
Linux 日期 Date Command 使用 example usage date format
@Chunlin-Li
Chunlin-Li / 10291442.sh
Created October 29, 2015 06:41
Linux 下创建一个 service. create a Linux daemon / service
#! /bin/sh
NAME=XXXXXXXXXX
DESC="XXXXXXXXXXXXXXXX"
PIDFILE="/var/run/${NAME}.pid"
LOGFILE="/var/log/${NAME}.log"
# path to the target executable file
DAEMON="/PATH/TO/EXECUTABLE/FILE"
@Chunlin-Li
Chunlin-Li / bash-prompt.md
Created August 5, 2015 14:34
Ubuntu Linux 命令提示符 格式修改

编辑当前用户的 home 路径下的 .bashrc 文件

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
#    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '    this is default settings
     PS1='${debian_chroot:+($debian_chroot)}\u : \W\$ '     this is set the prompt to  user : currentDir$ ls
fi
@Chunlin-Li
Chunlin-Li / versionStringCompare.java
Created June 17, 2015 10:32
版本字符串的比较
/**
* 比较两个版本。 0 :两个版本相等; 1 : version1 > version2; -1 : version1 < version2
* 仅适用于由数字和 "." 符号构成的版本号字符串。 对应正则规则 \d+(\.\d+)+
* 如果 version1 和 version 2 均为 empty 返回0 , 否则 empty 恒小于任意字符串。
*/
private static int compareVersionString(String version1, String version2) {
if(StringUtils.isEmpty(version1)) {
if(StringUtils.isEmpty(version2)){
return 0;
} else {
ubuntu 下 chrome web app 启动器路径
~/.local/share/applications/chrome-app-list.desktop
对应着安装在其中的 app 也在同一个路径下,
chrome-xxxxxxxx-Default.desktop
@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 / 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 ] };