Convert more templates

This commit is contained in:
Rico Sta. Cruz 2017-09-20 16:08:11 +08:00
parent 7affb8660e
commit b42136a897
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
5 changed files with 200 additions and 104 deletions

83
curl.md
View File

@ -1,52 +1,79 @@
--- ---
title: Curl title: Curl
category: CLI category: CLI
layout: 2017/sheet
updated: 2017-09-20
--- ---
Options: ## Options
-o <file> # --output: write to file ### Options
-u user:pass # --user: Authentication
-v # --verbose ```bash
-vv # Even more verbose -o <file> # --output: write to file
-u user:pass # --user: Authentication
```
-I # --head: headers only ```bash
-v # --verbose
-vv # Even more verbose
```
Request: ```bash
-I # --head: headers only
```
-X POST # --request ### Request
Data options: ```bash
-X POST # --request
```
-d 'data' # --data: HTTP post data, URL encoded (eg, status="Hello") ### Data
-d @file # --data via file
-G # --get: send -d data via get
Headers: ```bash
-d 'data' # --data: HTTP post data, URL encoded (eg, status="Hello")
-d @file # --data via file
-G # --get: send -d data via get
```
-A <str> # --user-agent ### Headers
-b name=val # --cookie
-b FILE # --cookie
-H "X-Foo: y" # --header
--compressed # use deflate/gzip
SSL: ```bash
-A <str> # --user-agent
-b name=val # --cookie
-b FILE # --cookie
-H "X-Foo: y" # --header
--compressed # use deflate/gzip
```
### SSL
```bash
--cacert <file> --cacert <file>
--capath <dir> --capath <dir>
```
-E, --ecrt <cert> # --ecrt: Client cert file ```bash
--cert-type # der/pem/eng -E, --ecrt <cert> # --ecrt: Client cert file
-k, --insecure # for self-signed certs --cert-type # der/pem/eng
-k, --insecure # for self-signed certs
```
## Examples ## Examples
{: .-one-column}
# Post data: ```bash
curl -d password=x http://x.com/y # Post data:
curl -d password=x http://x.com/y
```
# Auth/data: ```bash
curl -u user:pass -d status="Hello" http://twitter.com/statuses/update.xml # Auth/data:
curl -u user:pass -d status="Hello" http://twitter.com/statuses/update.xml
```
# multipart file upload ```bash
curl -v -include --form key1=value1 --form upload=@localfilename URL # multipart file upload
curl -v -include --form key1=value1 --form upload=@localfilename URL
```

View File

@ -1,47 +1,71 @@
--- ---
title: Ffmpeg title: ffmpeg
category: CLI category: CLI
layout: 2017/sheet
--- ---
### Common switches ### Common switches
-codecs # list codecs ```bash
-c:v # video codec (-vcodec) - 'copy' to copy stream -codecs # list codecs
-c:a # audio codec (-acodec) -c:v # video codec (-vcodec) - 'copy' to copy stream
-c:a # audio codec (-acodec)
```
-fs SIZE # limit file size (bytes) ```bash
-fs SIZE # limit file size (bytes)
```
-b:v 1M # video bitrate (1M = 1Mbit/s) ### Bitrate
-b:a 1M # audio bitrate
-aspect RATIO # aspect ratio (4:3, 16:9, or 1.25) ```bash
-r RATE # frame rate per sec -b:v 1M # video bitrate (1M = 1Mbit/s)
-s WIDTHxHEIGHT # frame size -b:a 1M # audio bitrate
-vn # no video ```
-aq QUALITY # audio quality (codec-specific) ### Video
-ar 44100 # audio sample rate (hz)
-ac 1 # audio channels (1=mono, 2=stereo)
-an # no audio
-vol N # volume (256=normal)
-acodec ```bash
-vcodec -aspect RATIO # aspect ratio (4:3, 16:9, or 1.25)
-r RATE # frame rate per sec
-s WIDTHxHEIGHT # frame size
-vn # no video
```
### Audio
```bash
-aq QUALITY # audio quality (codec-specific)
-ar 44100 # audio sample rate (hz)
-ac 1 # audio channels (1=mono, 2=stereo)
-an # no audio
-vol N # volume (256=normal)
```
## Example
### Ringtone conversion using ffmpeg ### Ringtone conversion using ffmpeg
ffmpeg -i foo.mp3 -ac 1 -ab 128000 -f mp4 -acodec libfaac -y target.m4r ```bash
ffmpeg -i foo.mp3 -ac 1 -ab 128000 -f mp4 -acodec libfaac -y target.m4r
```
### To web ### To web
# no audio ```bash
ffmpeg -i input.mov -vcodec h264 -an -strict -2 output.mp4 # no audio
ffmpeg -i input.mov -vcodec libvpx -an output.webm ffmpeg -i input.mov -vcodec h264 -an -strict -2 output.mp4
ffmpeg -i input.mov -vcodec libvpx -an output.webm
```
ffmpeg -i input.mov -vcodec h264 -acodec aac -strict -2 output.mp4 ```bash
ffmpeg -i input.mov -vcodec libvpx -acodec libvorbis output.webm ffmpeg -i input.mov -vcodec h264 -acodec aac -strict -2 output.mp4
ffmpeg -i input.mov -vcodec libvpx -acodec libvorbis output.webm
```
<video width="320" height="240" controls> ```html
<source src="movie.mp4" type='video/mp4'></source> <video width="320" height="240" controls>
<source src="movie.webm" type='video/ogg'></source> <source src="movie.mp4" type='video/mp4'></source>
</video> <source src="movie.webm" type='video/ogg'></source>
</video>
```

65
find.md
View File

@ -1,46 +1,67 @@
--- ---
title: Find title: Find
category: CLI category: CLI
layout: 2017/sheet
--- ---
### Usage ### Usage
{: .-prime}
find <path> <conditions> <actions> ```bash
find <path> <conditions> <actions>
```
### Conditions ### Conditions
-name "*.c" ```bash
-name "*.c"
```
-user jonathan ```bash
-nouser -user jonathan
-nouser
```
-type f # File ```bash
-type d # Directory -type f # File
-type l # Symlink -type d # Directory
-type l # Symlink
```
-depth 2 # At least 3 levels deep ```bash
-regex PATTERN -depth 2 # At least 3 levels deep
-regex PATTERN
```
-newer file.txt ```bash
-newerm file.txt # modified newer than file.txt -newer file.txt
-newerX file.txt # [c]hange, [m]odified, [B]create -newerm file.txt # modified newer than file.txt
-newerXt "1 hour ago" # [t]imestamp -newerX file.txt # [c]hange, [m]odified, [B]create
-newerXt "1 hour ago" # [t]imestamp
```
### Condition flow ### Condition flow
\! -name "*.c" ```bash
\( x -or y \) \! -name "*.c"
\( x -or y \)
```
### Actions ### Actions
-exec rm {} \; ```bash
-print -exec rm {} \;
-delete -print
-delete
```
### Examples ### Examples
find . -name '*.jpg' ```bash
find . -name '*.jpg' -exec rm {} \; find . -name '*.jpg'
find . -name '*.jpg' -exec rm {} \;
find . -newerBt "24 hours ago" ```
```bash
find . -newerBt "24 hours ago"
```

View File

@ -1,9 +1,13 @@
--- ---
title: Tomdoc title: Tomdoc
category: Markup category: Markup
layout: 2017/sheet
--- ---
``` ### Tomdoc
{: .-prime}
```ruby
# Public: Duplicate some text an arbitrary number of times. # Public: Duplicate some text an arbitrary number of times.
# #
# text - The String to be duplicated. # text - The String to be duplicated.
@ -20,17 +24,17 @@ def multiplex(text, count)
end end
``` ```
See [tomdoc.org](http://tomdoc.org/).
### Tags ### Tags
``` - `Deprecated`
Deprecated - `Internal`
Internal - `Public`
Public
```
### Options ### Options
``` ```ruby
# options - The Hash options used to refine the selection (default: {}): # options - The Hash options used to refine the selection (default: {}):
# :color - The String color to restrict by (optional). # :color - The String color to restrict by (optional).
# :weight - The Float weight to restrict by. The weight should # :weight - The Float weight to restrict by. The weight should
@ -39,22 +43,32 @@ Public
### Yields ### Yields
```ruby
# Yields the Integer index of the iteration.
``` ```
Yields the Integer index of the iteration.
Returns the duplicated String. ```ruby
Returns nothing. # Returns the duplicated String.
Raises Errno::ENOENT if the file can't be found. ```
Returns something else and this is a wrapped
multi-line comment. ```ruby
# Returns nothing.
```
```ruby
# Raises Errno::ENOENT if the file can't be found.
```
```ruby
# Returns something else and this is a wrapped
# multi-line comment.
``` ```
### Signatures ### Signatures
``` ```ruby
# Signature # Signature
# #
# find_by_<field>[_and_<field>...](args) # find_by_<field>[_and_<field>...](args)
# #
``` ```
See [tomdoc.org](http://tomdoc.org/).

30
yaml.md
View File

@ -1,16 +1,26 @@
--- ---
title: Yaml title: Yaml
category: Markup category: Markup
layout: 2017/sheet
prism_languages: [yaml]
--- ---
Multiline: | ### Multiline strings
hello
world
Inheritance: &defaults ```yaml
a: 2 Multiline: |
b: 3 hello
world
Inherit: ```
<<: *defaults
b: 4 ### Inheritance
```yaml
parent: &defaults
a: 2
b: 3
child:
<<: *defaults
b: 4
```