Cheat sheet -----几乎所有编程语言的速查表

Cheat.sh是一个无需安装的在线工具,用于查询编程语言的语法和关键字。通过curl命令结合cht.sh和编程语言名称,可以方便地获取帮助信息。例如,查询特定问题时,可以添加问题详情。此外,它还提供extended explanation、代码高亮、历史记录、剪贴板集成、Tab补全以及匿名模式等功能。安装cht.sh后,查询命令更加简洁,甚至可以进入shell模式以实现更快捷的查询。

偶然发现一个比较好用的工具,可以用它作为学习任何一门编程语言reminder。

cheat.sh

这就是要介绍的主角了。不需要安装,只要联网且有http服务就可以岁时查询任何编程语言的一些语法和关键字。

cheat.sh的四种格式:
    curl cheat.sh/tar
    curl cht.sh/curl
    curl https://cheat.sh/rsync
    curl https://cht.sh/tr

这里写图片描述

用法:curl+cht.sh/编程语言名称/需要查询的关键字或者问题
举个例子:
    curl cht.sh/go/Pointers     ##查询go语言中指针
    [root@79 Desktop]# curl cht.sh/go/Pointers
p := Vertex{1, 2}  // p is a Vertex
q := &p            // q is a pointer to a Vertex
r := &Vertex{1, 2} // r is also a pointer to a Vertex

// The type of a pointer to a Vertex is *Vertex
// new creates a pointer to a new struct instance

    curl cht.sh/scala/Functions    ##scala语言中函数用法
    curl cht.sh/python/lambda      ##python中lamba函数
[root@79 Desktop]# curl cht.sh/python
# Python is a high-level programming language
# and python is a Python interpreter.

#   Python language cheat sheets at /python/
#   list of pages:      /python/:list     ##python中可查询的列表
#   learn python:       /python/:learn    ##python基本语法
#   search in pages:    /python/~keyword  ##关键字
如果想要查询具体怎么操作,就需要添加问题:
Example:
    curl cht.sh/go/reverse+a+list      ##怎样反转数组
    curl cht.sh/python/random+list+elements   #怎样在列表中随机选取元素

import random
foo = ['a', 'b', 'c', 'd', 'e']
print(random.choice(foo))

    curl cht.sh/js/parse+json
    curl cht.sh/lua/merge+tables      ##在lua中合并列表
    curl cht.sh/clojure/variadic+function  
如果查询内容不满意,可以看一些extended explanation.
    curl cht.sh/python/random+string
    curl cht.sh/python/random+string/1
    curl cht.sh/python/random+string/2

当然,为了更详细地解释查询内容,cheet sheets 中既有示例的代码,也有一些text comments。如果不喜欢的话,在命令后添加’?Q’就行。

    $ curl cht.sh/lua/table+keys?Q
    local keyset={}
    local n=0

    for k,v in pairs(tab) do
      n=n+1
      keyset[n]=k
    end

而且一般变量都会被高亮,’?T’可以去除高亮。

    curl cht.sh/lua/merge+tables?QT
cht.sh

cheat.sh 服务有自己专有的使用命令,就是cht.sh。

用这个命令有什么好处呢?
  • Special shell mode with a persistent queries context and readline support.
  • Queries history.
  • Clipboard integration.
  • Tab completion support for shells (bash, fish, zsh).
  • Stealth mode. (匿名模式)

首先安装一下:

    curl https://cht.sh/:cht.sh > /bin/cht.sh
    chmod +x /bin/cht.sh

安装以后,就不需要再使用curl了,极大简化了查询的命令。

    $ cht.sh go reverse a list
    $ cht.sh python random list elements
    $ cht.sh js parse json
如果还要更方便的话,可以进入shell模式,便捷查询。
    $ cht.sh --shell
    cht.sh> go reverse a list
切换到go语言查询
    $ cht.sh --shell
    cht.sh> cd go
    cht.sh/go> reverse a list
或者:
    $ cht.sh --shell go
    cht.sh/go> reverse a list
    ...
    cht.sh/go> join a list
    ...
SHELL中自动补齐
Bash Tab completion

To activate tab completion support for cht.sh, add the :bash_completion script to your ~/.bashrc:

    $ curl https://cheat.sh/:bash_completion > ~/.bash.d/cht.sh
    $ . ~/.bash.d/cht.sh
    $ # and add . ~/.bash.d/cht.sh to ~/.bashrc

资料:https://github.com/chubin/cheat.sh

比较简短的C语言教程,英文资料 1.0 Introduction 1.1 The main() Function 1.2 Include Files 1.3 Whitespace 1.4 The Preprocessor 1.4.1 The #define Directive 1.4.2 Comments 1.4.3 The #include Directive 1.4.4 The #ifdef/#else/#endif Directives 1.4.5 More Directives 1.4.6 Predefined Macros 2.0 Basic Data Types 2.1 Signed Integer Types 2.2 Unsigned Integer Types 2.3 Integer Overflow 2.4 Real Data Types 2.5 BCC32 Implementation 2.6 The void Type 3.0 Control Flow 3.1 The if/else/endif Statements 3.2 Compound Statements 3.3 Nested if Statements 3.4 The switch/case Statement 3.5 The for Statement 3.6 The while Statement 3.7 The do/while Statement 3.8 The break Statement 3.9 The continue Statement 3.10 The goto Statement 3.11 The return Statement 4.0 Expressions and Operators 4.1 Basic Arithmetic Operators 4.2 Promotion and Casting 4.3 More Arithmetic Operators 4.4 Assignment Operators 4.5 Bitwise Operators 4.6 Relational Operators 4.7 Logical Operators 4.8 The Conditional Operator The C Cheat Sheet Revision 1 Copyright ? 2000 Andrew Sterian iv 4.9 The Comma Operator 4.10 Operator Precedence and Association 5.0 Program Structure 5.1 Declaring Functions 5.2 Calling Functions 5.3 Local Variables 5.4 Global Variables 6.0 Advanced Data Types 6.1 Arrays 6.2 Structures 6.3 Pointers 6.4 Strings 6.4.1 String Pointers 6.4.2 String Operations 6.5 Enumerated Types 6.6 Bitfields 6.7 Unions 7.0 Advanced Programming Concepts 7.1 Standard I/O 7.1.1 Opening Files 7.1.2 Writing to File Pointers 7.1.3 Reading from File Pointers 7.1.4 The stdin/stdout/stderr Streams 7.2 Dynamic Memory Allocation 7.3 Memory Manipulation 7.4 Declaring New Types 7.5 Pointers to Functions 7.6 Command-Line Parameters 8.0 Multi-File Programs 8.1 Basic Concepts 8.2 Include Files as Interfaces 8.3 Object Files and Linking 8.4 The Details of the Compilation Process 9.0 The Standard C Library 9.1 Assertion Checking 9.2 Character Classification 9.3 Error Reporting 9.4 Buffer Manipulation 9.5 Non-Local Jumps 9.6 Event Signalling 9.7 Variable-Length Argument Lists 9.8 Miscellaneous Functions 9.9 String Handling 9.10 Time Functions 9.11 Floating-Point Math 9.12 Standard I/O 10.0 Tips, Tricks, and Caveats 10.1 Infinite Loops 10.2 Unallocated Storage 10.3 The Null Statement 10.4 Extraneous Semicolons 10.5 strcmp is Backwards 10.6 Unterminated Comments 10.7 Equality and Assignment 10.8 Assertion Checking 10.9 Error Checking 10.10 Programming Style 11.0 Differences between Java and C
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值