Skip to content

Instantly share code, notes, and snippets.

View liuxd's full-sized avatar
🗿
Hi, there.

Allen Liu liuxd

🗿
Hi, there.
  • Tax Traders
  • Auckland, New Zealand
View GitHub Profile
@liuxd
liuxd / fix.rb
Last active September 7, 2017 01:33
[Blog Fixer] 将原来的博客md文件去掉头部信息。
#!/usr/bin/env ruby
def traverse(filepath)
if filepath.include? '.git' or filepath.include? '.DS_Store' or filepath.include? 'README'
return
end
if File.directory?(filepath)
# puts "Dirs:" + filepath
@liuxd
liuxd / CLI.md
Last active June 28, 2022 08:24
[Command Line List] #Tips

命令

  • watch 监控命令输出内容。
    • eg: watch 'ps -ef|grep php'
  • wc 计算输出的行数或字符数等。
    • eg: cat test.txt|wc -l
  • curl 发http请求。
    • eg: curl "http://baidu.com" -H "Host: baidu.com"
    • eg: curl -I http://google.com 只获得头信息。
    • eg: curl "http://google.com" -x 10.10.100.12 指定IP
@liuxd
liuxd / Git.md
Last active June 23, 2021 23:48
[Git] #Tips

问:如何统计commit的总数?

答:

git log --oneline|wc -l

问:如何删除本地分支和远端分支?

答:

@liuxd
liuxd / MySQL.md
Last active November 9, 2018 01:19
[MySQL] #Tips

Where are the logs?

SHOW  GLOBAL VARIABLES LIKE '%log%';

Where is the my.cnf in MacOSX?

There is no one.If you need one in /usr/local/mysql/support-files/, and cp one to /etc/

@liuxd
liuxd / PHP.md
Last active November 9, 2018 01:20
[PHP] #Tips

{} for String

$a = 'abc';
echo $a{0}; // Output: a
echo $a{1}; // Output: b

How to check if a string's length is enough?

@liuxd
liuxd / SublimeText.md
Last active November 9, 2018 01:19
[Sublime Text] #Tips

在文件夹内搜索时忽略某些文件

{
    "file_exclude_patterns":
	[
		".tags",
		".tags_sorted_by_file"
	],
}
@liuxd
liuxd / Vim-cn.md
Last active November 9, 2018 01:20
[Vim] #Tips
  • :set list 显示空格字符。
  • :%s/xxx/ooo/g 全文替换
  • :helptags ~/.vim/doc/ 载入帮助文档
  • :vnew 垂直分割窗口
  • :set nu 显示行号
  • :g/$pattern/d 正则删除行

会话相关

  • :mksession! xxx.vim 保存会话
  • :source xxx.vim 恢复会话
@liuxd
liuxd / WeChatMini.md
Last active November 9, 2018 01:20
[WeChatMini] #Tips

快速创建页面

官方提供的IDE虽然编辑功能比较弱,但是有一个功能很不错——自动创建页面基本文件。当在app.json里面增加一个pages的页面配置的时候,IDE会自动创建对应的目录和四个基本文件。这比手动一个一个创建快捷得多。

调试指定页面

把需要开发调试的页面放到app.jsonpages的第一个位置的时候,打开app就是这个页面。

点击按钮获得指定表单的值

$ curl ifconfig.me
$ curl icanhazip.com
$ curl ident.me
$ curl ipecho.net/plain
$ curl whatismyip.akamai.com
$ curl myip.dnsomatic.com

The configure file is /etc/sudoers.

For all the group of admin:

%admin ALL=(ALL) NOPASSWD: NOPASSWD ALL

For the user of liuxd:

liuxd ALL=(ALL) NOPASSWD: ALL