Skip to content

Instantly share code, notes, and snippets.

View laixintao's full-sized avatar
📟
I live in the terminal.

laixintao

📟
I live in the terminal.
View GitHub Profile
@laixintao
laixintao / linux_command_wc.sh
Created November 4, 2017 16:39
统计linux命令使用率
#!/bin/sh
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
#!/bin/zsh -f
autoload -U colors
colors
print "
ZSH Color definitions:
\e[1mprompt simple\e[0m [\e[1m<\e[0mcolor1\e[1m>\e[0m[\e[1m<\e[0mcolor2\e[1m>\e[0m[\e[1m<\e[0mcolor3\e[1m>\e[0m[\e[1m<\e[0mstring1\e[1m>\e[0m[\e[1m<\e[0mstring2\e[1m>\e[0m[\e[1m<\e[0mstring3\e[1m>\e[0m]]]]]]
Supply up to three \e[1mcolors\e[0m and then up to three alternate static \e[1mprompt strings \e[0m.
\e[1mcolor1\e[0m is the local prompt color: \e[1mzsh-% \e[0m color1=default
\e[1mcolor2\e[0m is the remote prompt color: \e[31m$HOST:r:r-%\e[0m color2=red
\e[1mcolor3\e[0m is the screensession prompt color: \e[1mScreen-% \e[0m color3=default
" Installing plugins to /Users/laixintao/.vim/bundle
Plugin 'gmarik/vundle'
Plugin 'Valloric/YouCompleteMe'
Plugin 'davidhalter/jedi-vim'
Plugin 'The-NERD-tree'
Plugin 'majutsushi/tagbar'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'kchmck/vim-coffee-script'
Plugin 'carlosvillu/coffeScript-VIM-Snippets'
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
@laixintao
laixintao / a.py
Created November 24, 2017 02:31
use importlib
def foo():
print("foo print ")
@laixintao
laixintao / dp.py
Created December 20, 2017 09:13
fibonacci without dp or with dp
# -*- coding: utf-8 -*-
import time
def normal_fib(n):
if n == 0 or n == 1:
return n
return normal_fib(n - 1) + normal_fib(n - 2)
# -*- coding: utf-8 -*-
for i in range (10):
print(i)
print(i)
curl -Iv https://t.tt
* Rebuilt URL to: https://t.tt/
* Trying 140.143.118.208...
* TCP_NODELAY set
* Connected to t.tt (140.143.118.208) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
~/Downloads  ipython
Python 3.6.3 (default, Nov 3 2017, 14:41:25)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: i = 'foo'
In [2]: [i for i in range(10)]
Out[2]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
import a
print("First time import a, a.foo={}".format(a.foo))
a.foo = 'bar'
import a
print("Second time import a(from sys.module), a.foo={}".format(a.foo))