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
category: CLI
layout: 2017/sheet
updated: 2017-09-20
---
Options:
## Options
-o <file> # --output: write to file
-u user:pass # --user: Authentication
### Options
-v # --verbose
-vv # Even more verbose
```bash
-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")
-d @file # --data via file
-G # --get: send -d data via get
### Data
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
-b name=val # --cookie
-b FILE # --cookie
-H "X-Foo: y" # --header
--compressed # use deflate/gzip
### Headers
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>
--capath <dir>
```
-E, --ecrt <cert> # --ecrt: Client cert file
--cert-type # der/pem/eng
-k, --insecure # for self-signed certs
```bash
-E, --ecrt <cert> # --ecrt: Client cert file
--cert-type # der/pem/eng
-k, --insecure # for self-signed certs
```
## Examples
{: .-one-column}
# Post data:
curl -d password=x http://x.com/y
```bash
# Post data:
curl -d password=x http://x.com/y
```
# Auth/data:
curl -u user:pass -d status="Hello" http://twitter.com/statuses/update.xml
```bash
# Auth/data:
curl -u user:pass -d status="Hello" http://twitter.com/statuses/update.xml
```
# multipart file upload
curl -v -include --form key1=value1 --form upload=@localfilename URL
```bash
# 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
layout: 2017/sheet
---
### Common switches
-codecs # list codecs
-c:v # video codec (-vcodec) - 'copy' to copy stream
-c:a # audio codec (-acodec)
```bash
-codecs # list codecs
-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)
-b:a 1M # audio bitrate
### Bitrate
-aspect RATIO # aspect ratio (4:3, 16:9, or 1.25)
-r RATE # frame rate per sec
-s WIDTHxHEIGHT # frame size
-vn # no video
```bash
-b:v 1M # video bitrate (1M = 1Mbit/s)
-b:a 1M # audio bitrate
```
-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)
### Video
-acodec
-vcodec
```bash
-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
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
# no audio
ffmpeg -i input.mov -vcodec h264 -an -strict -2 output.mp4
ffmpeg -i input.mov -vcodec libvpx -an output.webm
```bash
# no audio
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
ffmpeg -i input.mov -vcodec libvpx -acodec libvorbis output.webm
```bash
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>
<source src="movie.mp4" type='video/mp4'></source>
<source src="movie.webm" type='video/ogg'></source>
</video>
```html
<video width="320" height="240" controls>
<source src="movie.mp4" type='video/mp4'></source>
<source src="movie.webm" type='video/ogg'></source>
</video>
```

65
find.md
View File

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

View File

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

30
yaml.md
View File

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