Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I wrote like 10 lines of code a week then I sleep.

laixintao

💭
I wrote like 10 lines of code a week then I sleep.
View GitHub Profile
View Snap photo with html5.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
@laixintao
laixintao / JavaReflection.java
Created Oct 17, 2016
Java的反射机制例子
View JavaReflection.java
package cn.lee.demo;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.TypeVariable;
public class Main {
View Singleton.java
public class Jackpot {
private static Jackpot jackpot;
private ArrayList<Bet> betHistory;
private Jackpot() {
this.betHistory = new ArrayList<Bet>();
}
public boolean addBet(Bet bet) {
this.betHistory.add(bet);
View autocmd.vim
"为不同的文件类型设置不同的空格数替换TAB
autocmd FileType php,python,c,java,perl,shell,bash,vim,ruby,cpp set ai
autocmd FileType php,python,c,java,perl,shell,bash,vim,ruby,cpp set sw=4
autocmd FileType php,python,c,java,perl,shell,bash,vim,ruby,cpp set ts=4
autocmd FileType php,python,c,java,perl,shell,bash,vim,ruby,cpp set sts=4
autocmd FileType javascript,html,css,xml set ai
autocmd FileType javascript,html,css,xml set sw=2
autocmd FileType javascript,html,css,xml set ts=2
autocmd FileType javascript,html,css,xml set sts=2
@laixintao
laixintao / tmux-keys
Created Feb 15, 2017
tmux快速上手
View tmux-keys
“ 将当前面板上下分屏
% 将当前面板左右分屏
x 关闭当前分屏
! 将当前面板置于新窗口,即新建一个窗口,其中仅包含当前面板
Ctrl+方向键 以1个单元格为单位移动边缘以调整当前面板大小
Alt+方向键 以5个单元格为单位移动边缘以调整当前面板大小
空格键 可以在默认面板布局中切换,试试就知道了
q 显示面板编号
o 选择当前窗口中下一个面板
View tmux-cheatsheet.markdown

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
@laixintao
laixintao / tmux.conf.bak
Created Jun 21, 2017 — forked from Jiezhi/tmux.conf.bak
tmux configure file from 《tmux:Productive Mouse-Free Development》
View tmux.conf.bak
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
#setting the delay between prefix and command
set -sg escape-time 1
# Ensure that we can send Ctrl-A to other apps
@laixintao
laixintao / .gitconfig
Created Jun 29, 2017 — forked from berngp/.gitconfig
dot.gitconfig
View .gitconfig
[user]
name = Your Name
email = your.name@mail.com
[color]
ui = true
[core]
excludesfile = ~/.gitignore_global
editor = /usr/local/bin/mvim -f
View re_group_vs_groups.md

group([group1, ...])

Returns one or more subgroups of the match. If there is a single argument, the result is a single string; if there are multiple arguments, the result is a tuple with one item per argument. Without arguments, group1 defaults to zero (the whole match is returned). If a groupN argument is zero, the corresponding return value is the entire matching string; if it is in the inclusive range [1..99], it is the string matching the corresponding parenthesized group. If a group number is negative or larger than the number of groups defined in the pattern, an IndexError exception is raised. If a group is contained in a part of the pattern that did not match, the corresponding result is None. If a group is contained in a part of the pattern that matched multiple times, the last match is returned.

>>>
>>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
>>> m.group(0)       # The entire match
'Isaac Newton'
>>> m.group(1)       # The first parenthesized subgroup.
'Isaa
@laixintao
laixintao / qrify
Created Jul 17, 2017
Generate QR code in shell.
View qrify
#!/bin/bash
# Author: Linyos Torovoltos github.com/linyostorovovoltos
currentVersion="1.13.0"
multiline="0" # flag that indicates multiline option
getConfiguredClient()
{
if command -v curl &> /dev/null ; then