Skip to content

yurenchen000/howto.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 

Repository files navigation

howto.sh

the bash version of https://github.com/antonmedv/howto

asciicast demo1

asciicast demo2

usage

in bash

1. setup

$ source howto.sh  bind1

## for DeepSeek (is slow)
$ HOWTO_APIURL='https://api.deepseek.com/v1/chat/completions'
$ HOWTO_APIKEY='YOUR DEEPSEEK APIKEY'
$ HOWTO_MODEL='deepseek-chat'

## for OpenAI (or compatible api)
$ HOWTO_APIURL='https://api.openai.com/v1/chat/completions'
$ HOWTO_APIKEY='YOUR OPENAI APIKEY'
$ HOWTO_MODEL='gpt-4o'

## for Qwen (Pretty fast, Not openai compatible)
$ HOWTO_APIURL='https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation'
$ HOWTO_APIKEY='YOUR QWEN APIKEY'
$ HOWTO_MODEL='qwen-plus-latest'  # better


## qwen models
HOWTO_MODEL='qwen-flash'

HOWTO_MODEL='qwen-turbo'
HOWTO_MODEL='qwen-turbo-latest' ## fine

HOWTO_MODEL='qwen-plus'
HOWTO_MODEL='qwen-plus-latest'  ## fine 2

HOWTO_MODEL='qwen-max-latest'   ## fine
HOWTO_MODEL='qwen-max'          ## fine 2

NOTE: HOWTO_APIURL can be omitted (guess from HOWTO_MODEL)


more usage demo wiki

2. usage demo

$ howto find files modified today
== cmd is: find / -type f -mtime 0
$ find / -type f -mtime 0      <### this line auto-inputed by howto.sh, omitted in later

$ howto git clone use ssh:// for 'ssh android@localhost -p 4022' /tmp/test1
$                              <### sometime i forget the git url scheme
== cmd is: git clone ssh://android@localhost:4022/tmp/test1

$ howto convert demo2.gif to demo2.mp4, frame rate 30, twitter compatible  
$                              <### i guess no one remember all the parameters
== cmd is: ffmpeg -i demo2.gif -vf "fps=30,scale=trunc(iw/2)*2:trunc(ih/2)*2" -c:v libx264 -pix_fmt yuv420p demo2.mp4

note1: AI may make mistakes, check before pressing Enter

note2: deepseek query is slow (about 4 seconds)


TIPS: Ctrl + G will prepend howto cmd and query


3. use ctrl+g completion

bind -x '"\C-g": "c_howto"'

//this will show howto in cli & history

OR

bind -x '"\C-g": "c_howto2"'

//this not show howto in cli & history

then input the search string, for example:

$ find files modified today

then press Ctrl+G to trigger completion


Other Bash Script

other bash repos