Merge branch 'master' into master

This commit is contained in:
David Peter 2020-10-30 19:36:27 +01:00 committed by GitHub
commit 3a612f063e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 2085 additions and 65 deletions

View File

@ -58,6 +58,11 @@ jobs:
with: with:
command: test command: test
args: --release args: --release
- name: Run ignored-by-default unit tests with new syntaxes and themes
uses: actions-rs/cargo@v1
with:
command: test
args: --release -- --ignored
- name: Syntax highlighting regression test - name: Syntax highlighting regression test
run: tests/syntax-tests/regression_test.sh run: tests/syntax-tests/regression_test.sh
- name: List of languages - name: List of languages

6
.gitmodules vendored
View File

@ -200,3 +200,9 @@
[submodule "assets/syntaxes/02_Extra/Ninja"] [submodule "assets/syntaxes/02_Extra/Ninja"]
path = assets/syntaxes/02_Extra/Ninja path = assets/syntaxes/02_Extra/Ninja
url = https://github.com/pope/SublimeNinja.git url = https://github.com/pope/SublimeNinja.git
[submodule "assets/syntaxes/02_Extra/Svelte"]
path = assets/syntaxes/02_Extra/Svelte
url = https://github.com/corneliusio/svelte-sublime
[submodule "assets/themes/Coldark"]
path = assets/themes/Coldark
url = https://github.com/ArmandPhilippot/coldark-bat.git

View File

@ -1,6 +1,5 @@
# unreleased # unreleased
- Add Note to refer to see detailed help with --help (and vice versa with -h). see #1215 (@henil)
## Features ## Features
@ -8,14 +7,22 @@
## Bugfixes ## Bugfixes
- Throws an error when `bat` is being used as `pager`, see #1343 (@adrian-rivera)
## Other ## Other
- Add note to refer to see detailed help with `--help` (and vice versa with `-h`), see #1215 (@henil)
- Add a `Contributors` section to `README`, see #1348 (@adrian-rivera)
## Syntaxes ## Syntaxes
- Manpage syntax highlighting has been improved, see #1315 (@keith-hall) - Manpage syntax highlighting has been improved, see #1315 (@keith-hall)
- Add Svelte file syntax, see #1285 (@kjmph)
## New themes ## New themes
- Coldark, see #1329 (@armandphilippot)
## `bat` as a library ## `bat` as a library
## Packaging ## Packaging

48
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,48 @@
# Contributing
Thank you for considering to contribute to `bat`!
## Add an entry to the changelog
If your contribution changes the behavior of `bat` (as opposed to a typo-fix
in the documentation), please update the [`CHANGELOG.md`](CHANGELOG.md) file
and describe your changes. This makes the release proess much easier and
therefore helps to get your changes into a new `bat` release faster.
The top of the `CHANGELOG` contains a *"unreleased"* section with a few
subsections (Features, Bugfixes, …). Please add your entry to the subsection
that best describes your change
Entries follow this format:
```
- Short description of what has been changed, see #123 (@user)
```
Here, `#123` is the number of the original issue and/or your pull request.
Please replace `@user` by your GitHub username.
## Development
Please check out the [Development](https://github.com/sharkdp/bat#development)
section in the README.
## Adding a new feature
Please consider opening a
[feature request ticket](https://github.com/sharkdp/bat/issues/new?assignees=&labels=feature-request&template=feature_request.md)
first in order to give us a chance to discuss the feature first.
## Adding new syntaxes/languages or themes
Before you make a pull request that adds a new syntax or theme, please read
the [Customization](https://github.com/sharkdp/bat#customization) section
in the README first.
If you really think that a particular syntax or theme should be added for all
users, please read the corresponding
[documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md)
first.

View File

@ -131,7 +131,18 @@ highlighting:
git show v0.6.0:src/main.rs | bat -l rs git show v0.6.0:src/main.rs | bat -l rs
``` ```
Note that syntax highlighting within diffs is currently not supported. If you are looking for this, check out [`delta`](https://github.com/dandavison/delta). #### `git diff`
You can combine `bat` with `git diff` to view lines around code changes with proper syntax
highlighting:
```bash
batdiff() {
git diff --name-only --diff-filter=d | xargs bat --diff
}
```
If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras).
If you are looking for more support for git and diff operations, check out [`delta`](https://github.com/dandavison/delta).
#### `xclip` #### `xclip`
@ -665,6 +676,10 @@ bash assets/create.sh
cargo install --path . --locked --force cargo install --path . --locked --force
``` ```
## Contributing
Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
## Maintainers ## Maintainers
- [sharkdp](https://github.com/sharkdp) - [sharkdp](https://github.com/sharkdp)

View File

@ -34,11 +34,11 @@ contexts:
scope: markup.heading.title.man scope: markup.heading.title.man
- match: \s\s - match: \s\s
pop: true pop: true
- match: '(?=\S)' - match: '(?=\S|$)'
pop: true pop: true
- match: '$' - match: '$'
push: body set: body
body: body:
# English, ..., ..., ..., Russian, ... # English, ..., ..., ..., Russian, ...
@ -48,14 +48,16 @@ contexts:
embed: synopsis embed: synopsis
escape: '(?={{section_heading}})' escape: '(?={{section_heading}})'
- match: '^(?:USAGE)'
scope: markup.heading.synopsis.man
embed: synopsis
escape: '(?={{section_heading}})'
- match: '{{section_heading}}' - match: '{{section_heading}}'
scope: markup.heading.other.man scope: markup.heading.other.man
embed: options # some man pages put command line options under the description heading embed: options # some man pages put command line options under the description heading
escape: '(?={{section_heading}})' escape: '(?={{section_heading}})'
- include: function-call
function-call: function-call:
- match: '\b([A-Za-z0-9_\-]+)(\()([^)]*)(\))' - match: '\b([A-Za-z0-9_\-]+)(\()([^)]*)(\))'
captures: captures:
@ -83,6 +85,7 @@ contexts:
- match: '' - match: ''
pop: true pop: true
- include: function-call - include: function-call
- include: c-code
expect-command-line-option: expect-command-line-option:
- match: '[A-Za-z0-9-]+' - match: '[A-Za-z0-9-]+'
@ -127,9 +130,15 @@ contexts:
- match: '$|(?=[],]|{{command_line_option}})' - match: '$|(?=[],]|{{command_line_option}})'
pop: true pop: true
c-code:
- match: '^(?=\s+(?:#include\b|#define\b|/\*|struct\s+(\w+\s*)?\{))'
embed: scope:source.c
#embed_scope: source.c.embedded.man
#escape: ^(?!#|\1|\s*(?:$|/\*|#include\b|#define\b))
escape: ^(?=\s*(?:\(.*\.\)\s*$|[A-Z](?![A-Z])))
synopsis: synopsis:
- match: '^(?=\s+(?:#include|/\*))' - include: c-code
push: scope:source.c
- match: \[ - match: \[
scope: punctuation.section.brackets.begin.man scope: punctuation.section.brackets.begin.man
push: command-line-option-or-pipe push: command-line-option-or-pipe
@ -140,6 +149,7 @@ contexts:
captures: captures:
1: keyword.operator.logical.man 1: keyword.operator.logical.man
#- match: (?={{command_line_option}}) #- match: (?={{command_line_option}})
- match: \w+-\w+
- match: (?=-) - match: (?=-)
push: push:
- match: (?=\s*\|) - match: (?=\s*\|)

1
assets/syntaxes/02_Extra/Svelte vendored Submodule

@ -0,0 +1 @@
Subproject commit bf92f5b7b69c8ea641d6822fd6d12cc2d9341956

View File

@ -5,7 +5,7 @@ SOMETHING(8) System Manager's Manual SOMETHING(8)
# ^^^^^^^ meta.preprocessor # ^^^^^^^ meta.preprocessor
NAME NAME
#^^^ markup.heading.title #^^^ markup.heading.other
example - do something useful example - do something useful
SYNOPSIS SYNOPSIS
@ -45,9 +45,16 @@ SYNOPSIS
[--quiet] [--debug] [--help|-h] [--version] [--conf FILE] [--quiet] [--debug] [--help|-h] [--version] [--conf FILE]
/* According to POSIX.1-2001, POSIX.1-2008 */ /* According to POSIX.1-2001, POSIX.1-2008 */
# ^^ source comment.block punctuation.definition.comment # ^^ source.c comment.block punctuation.definition.comment
#include <sys/select.h> #include <sys/select.h>
# ^^^^^^^^ source meta.preprocessor.include keyword.control.import.include # ^^^^^^^^ source.c meta.preprocessor.include keyword.control.import.include
struct timeval {
# ^^^^^^ source.c storage.type
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
DESCRIPTION DESCRIPTION
@ -123,3 +130,22 @@ OPTIONS
# ^^^ variable.parameter # ^^^ variable.parameter
# ^^ - variable # ^^ - variable
output NUM (default 3) lines of copied context output NUM (default 3) lines of copied context
EXAMPLE
#include <stdio.h>
# ^^^^^^^^ source.c meta.preprocessor.include keyword.control.import.include
(This is not C code.)
# ^^^^^^^^^^^^^^^^^^^^^^ - source.c
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
# ^ source.c punctuation.terminator
The corresponding argument for pselect() has the following type:
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - source.c
#define POLLIN_SET (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN |
EPOLLHUP | EPOLLERR)
# ^ source.c meta.preprocessor.macro meta.group punctuation.section.group.end

BIN
assets/themes.bin vendored

Binary file not shown.

1
assets/themes/Coldark vendored Submodule

@ -0,0 +1 @@
Subproject commit b4a1c74d8d5bdd136ec530e5905b810272472545

View File

@ -205,6 +205,14 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
writeln!(stdout, "{}", theme)?; writeln!(stdout, "{}", theme)?;
} }
} }
writeln!(
stdout,
"Further themes can be installed to '{}', \
and are added to the cache with `bat cache --build`. \
For more information, see:\n\n \
https://github.com/sharkdp/bat#adding-new-themes",
config_file().join("themes").to_string_lossy()
)?;
Ok(()) Ok(())
} }

View File

@ -20,6 +20,10 @@ error_chain! {
description("unknown syntax"), description("unknown syntax"),
display("unknown syntax: '{}'", name) display("unknown syntax: '{}'", name)
} }
InvalidPagerValueBat {
description("invalid value `bat` for pager property"),
display("Use of bat as a pager is disallowed in order to avoid infinite recursion problems")
}
} }
} }

View File

@ -85,10 +85,10 @@ impl OutputType {
match pagerflags.split_first() { match pagerflags.split_first() {
Some((pager_name, args)) => { Some((pager_name, args)) => {
let mut pager_path = PathBuf::from(pager_name); let pager_path = PathBuf::from(pager_name);
if pager_path.file_stem() == Some(&OsString::from("bat")) { if pager_path.file_stem() == Some(&OsString::from("bat")) {
pager_path = PathBuf::from("less"); return Err(ErrorKind::InvalidPagerValueBat.into());
} }
let is_less = pager_path.file_stem() == Some(&OsString::from("less")); let is_less = pager_path.file_stem() == Some(&OsString::from("less"));

View File

@ -1,7 +1,9 @@
use bat::assets::HighlightingAssets; use bat::assets::HighlightingAssets;
/// This test ensures that we are not accidentally removing themes due to submodule updates. /// This test ensures that we are not accidentally removing themes due to submodule updates.
/// It is 'ignore'd by default because it requires themes.bin to be up-to-date.
#[test] #[test]
#[ignore]
fn all_themes_are_present() { fn all_themes_are_present() {
let assets = HighlightingAssets::from_binary(); let assets = HighlightingAssets::from_binary();
@ -12,6 +14,8 @@ fn all_themes_are_present() {
themes, themes,
vec![ vec![
"1337", "1337",
"Coldark-Cold",
"Coldark-Dark",
"DarkNeon", "DarkNeon",
"Dracula", "Dracula",
"GitHub", "GitHub",

View File

@ -405,6 +405,16 @@ fn pager_disable() {
.stdout(predicate::eq("hello world\n").normalize()); .stdout(predicate::eq("hello world\n").normalize());
} }
#[test]
fn pager_value_bat() {
bat()
.arg("--pager=bat")
.arg("--paging=always")
.arg("test.txt")
.assert()
.failure();
}
#[test] #[test]
fn alias_pager_disable() { fn alias_pager_disable() {
bat() bat()

View File

@ -0,0 +1,44 @@
// selective import
import std.stdio : writeln, writefln;
// non-selective import
import std.algorithm;
/* a multiline comment
*
* this function is safe because it doesn't use pointer arithmetic
*/
int the_ultimate_answer() @safe {
 // assert1on
 assert(1 != 2);
 // now we can safely return our answer 
 return 42;
}
void main()
{
 // function call with string literal
 writeln("Hello World!");
 // an int array declaration
 int[] arr1 = [1, 2, 3];
 // an immutable double
 immutable double pi = 3.14;
 // a mutable double
 double d1 = pi;
 // a pointer
 double* dp1 = &d1;
 // another pointer to the same thingy
 auto a1 = &d1;
 // a constant bool
 const bool b1 = true;
 if (b1) {
 // another function call 
 writefln("%s\n%s\n%s\n", arr1, d1, the_ultimate_answer());
 }
 else if (!b1) {
 writeln("this seems wrong");
 }
 else {
 writeln("I'm giving up, this is too crazy for me");
 }
}

View File

@ -0,0 +1,67 @@
root:x:0:root
sys:x:3:bin
mem:x:8:
ftp:x:11:
mail:x:12:
log:x:19:
smmsp:x:25:
proc:x:26:polkitd
games:x:50:
lock:x:54:
network:x:90:
floppy:x:94:
scanner:x:96:
power:x:98:
adm:x:999:daemon
wheel:x:998:username
kmem:x:997:
tty:x:5:
utmp:x:996:
audio:x:995:mpd,username
disk:x:994:
input:x:993:
kvm:x:992:
lp:x:991:
optical:x:990:username
render:x:989:
storage:x:988:username
uucp:x:987:
video:x:986:username
users:x:985:
systemd-journal:x:984:
rfkill:x:983:
bin:x:1:daemon
daemon:x:2:bin
http:x:33:
nobody:x:65534:
dbus:x:81:
systemd-journal-remote:x:982:
systemd-network:x:981:
systemd-resolve:x:980:
systemd-timesync:x:979:
systemd-coredump:x:978:
uuidd:x:68:
username:x:1000:
git:x:977:
avahi:x:976:
colord:x:975:
polkitd:x:102:
mpd:x:45:
rtkit:x:133:
transmission:x:169:
wireshark:x:150:username
lightdm:x:974:
geoclue:x:973:
usbmux:x:140:
dhcpcd:x:972:
brlapi:x:971:
gdm:x:120:
libvirt:x:970:
flatpak:x:969:
gluster:x:968:
rpc:x:32:
tor:x:43:
rslsync:x:967:
docker:x:966:username
sambashare:x:1002:username
named:x:40:

View File

@ -0,0 +1,16 @@
#
# Comment
[attr]binary -diff -merge -text
* text=auto
*.c diff=c
*.cc text diff=cpp
*.o binary
*.bat text eol=crlf
*.lock text -diff
*.*ignore text
*.patch -text
.gitattributes linguist-language=gitattributes
.gitkeep export-ignore

View File

@ -0,0 +1,107 @@
[alias]
 br = branch
 branch = branch -a
 c = clone --recursive
 ci = commit
 cl = clone
 co = checkout
 contributors = shortlog --summary --numbered
 lg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
 remote = remote -v
 st = status
 tag = tag -l
[apply]
 whitespace = fix
[color]
 ui = true
[color "branch"]
 current = yellow
 local = yellow
 remote = green
[color "diff"]
 commit = yellow bold
 frag = magenta bold
 meta = yellow
 new = green bold
 old = red bold
 whitespace = red reverse
[color "diff-highlight"]
 newHighlight = green bold 22
 newNormal = green bold
 oldHighlight = red bold 52
 oldNormal = red bold
[color "status"]
 added = green
 changed = yellow
 untracked = cyan
[commit]
 gpgsign = true
[core]
 editor = /usr/bin/vim
 # global exclude
 excludesfile = /home/frank/.config/git/ignore
 pager = delta
 ; broken on old machines
 untrackedCache = true
[credential]
 helper = store
[delta]
 features = line-numbers decorations
 max-line-length = 1024
 whitespace-error-style = 22 reverse
[delta "decorations"]
 commit-decoration-style = bold yellow box ul
 file-decoration-style = none
 file-style = bold yellow
 syntax-theme = gruvbox
[diff]
 submodule = diff
 algorithm = histogram
 renames = copies
[difftool]
 prompt = false
[difftool "wrapper"]
 binary = true
 cmd = git-difftool-wrapper \"$LOCAL\" \"$REMOTE\"
[diff "pdfconv"]
 textconv = pdftohtml -stdout
[fetch]
 negotiationAlgorithm = skipping
 parallel = 0
[help]
 autocorrect = 1
[index]
 version = 4
[interactive]
 diffFilter = delta --color-only
[merge]
 log = true
[protocol]
 version = 2
[pull]
 rebase = true
[push]
 default = current
 recurseSubmodules = on-demand
[rebase]
 autoStash = true
[rerere]
 autoUpdate = true
 enabled = true
[sequence]
 editor = interactive-rebase-tool
[submodule]
 fetchJobs = 0
[tag]
 gpgSign = true
 sort = -version:refname
[url "git@gist.github.com:"]
 insteadOf = gist:
 pushInsteadOf = https://gist.github.com/
[url "git@github.com:"]
 insteadOf = gh:
 pushInsteadOf = https://github.com/
[user]
 email = f.nord@example.com
 name = Frank Nord
 signingkey = AAAAAAAAAAAAAAAA

View File

@ -0,0 +1,41 @@
digraph {
 label = <Label <font color='red'><b>formating</b></font>,<br/> test <font point-size='20'>is</font> done<br/> here <i>now.</i>>;
 node [shape=box]
 rankdir=LR
 margin=0.1
 a->b
 // http://www.graphviz.org/doc/info/colors.html
 // note: style=filled!
 node [shape=box colorscheme=paired12 style=filled]
 margin=0.1
 a2[fillcolor=1]
 b2[fillcolor=3]
 a2->b2->x2
 // http://www.graphviz.org/doc/info/colors.html
 // note: style=filled!
 node [shape=box colorscheme=paired12 style=filled]
 rankdir=LR
 margin=0.1
 c1[fillcolor=1]
 c2[fillcolor=2]
 c3[fillcolor=3]
 c4[fillcolor=4]
 c5[fillcolor=5]
 c6[fillcolor=6]
 c7[fillcolor=7]
 c8[fillcolor=8]
 c9[fillcolor=9]
 c10[fillcolor=10]
 c11[fillcolor=11]
 c12[fillcolor=12]
 c->{c1 c3 c5 c7 c9 c11}
 c1->c2
 c3->c4
 c5->c6
 c7->c8
 c9->c10
 c11->c12
}

View File

@ -0,0 +1,3 @@
graph {
 a--b
}

View File

@ -0,0 +1,34 @@
function zz=sample(aa)
%%%%%%%%%%%%%%%%%%
% some comments
%%%%%%%%%%%%%%%%%%
x = 'a string'; % some 'ticks' in a comment
y = 'a string with ''interal'' quotes';
for i=1:20
 disp(i);
end
a = rand(30);
b = rand(30);
c = a .* b ./ a \ ... comment at end of line and continuation
 (b .* a + b - a);
c = a' * b'; % note: these ticks are for transpose, not quotes.
disp('a comment symbol, %, in a string');
!echo abc % this isn't a comment - it's passed to system command
function y=myfunc(x)
y = exp(x);
%{
 a block comment
%}
function no_arg_func
fprintf('%s\n', 'function with no args')
end

View File

@ -1,12 +1,12 @@
BAT(1) General Commands Manual BAT(1) BAT(1) General Commands Manual BAT(1)
NAME NAME
 bat - a cat(1) clone with syntax highlighting and Git integration.  bat - a cat(1) clone with syntax highlighting and Git integration.
USAGE USAGE
 bat [OPTIONS] [FILE]...  bat [OPTIONS] [FILE]...
 bat cache [CACHE-OPTIONS] [--build|--clear]  bat cache [CACHE-OPTIONS] [--build|--clear]
DESCRIPTION DESCRIPTION
 bat prints the syntax-highlighted content of a collection of FILEs to  bat prints the syntax-highlighted content of a collection of FILEs to

View File

@ -18,9 +18,9 @@
 fd_set *exceptfds, const struct timespec *timeout,  fd_set *exceptfds, const struct timespec *timeout,
 const sigset_t *sigmask);  const sigset_t *sigmask);
 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):  Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
 pselect(): _POSIX_C_SOURCE >= 200112L  pselect(): _POSIX_C_SOURCE >= 200112L
DESCRIPTION DESCRIPTION
 select() allows a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become  select() allows a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become
@ -142,17 +142,17 @@
 The timeout  The timeout
 The timeout argument for select() is a structure of the following type:  The timeout argument for select() is a structure of the following type:
 struct timeval {  struct timeval {
 time_t tv_sec; /* seconds */  time_t tv_sec; /* seconds */
 suseconds_t tv_usec; /* microseconds */  suseconds_t tv_usec; /* microseconds */
 };  };
 The corresponding argument for pselect() has the following type:  The corresponding argument for pselect() has the following type:
 struct timespec {  struct timespec {
 time_t tv_sec; /* seconds */  time_t tv_sec; /* seconds */
 long tv_nsec; /* nanoseconds */  long tv_nsec; /* nanoseconds */
 };  };
 On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this.  On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this.
 (POSIX.1 permits either behavior.) This causes problems both when Linux code which reads timeout is ported to other operating  (POSIX.1 permits either behavior.) This causes problems both when Linux code which reads timeout is ported to other operating
@ -213,14 +213,14 @@
 Within the Linux kernel source, we find the following definitions which show the correspondence between the readable,  Within the Linux kernel source, we find the following definitions which show the correspondence between the readable,
 writable, and exceptional condition notifications of select() and the event notifications provided by poll(2) and epoll(7):  writable, and exceptional condition notifications of select() and the event notifications provided by poll(2) and epoll(7):
 #define POLLIN_SET (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN |  #define POLLIN_SET (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN |
 EPOLLHUP | EPOLLERR)  EPOLLHUP | EPOLLERR)
 /* Ready for reading */  /* Ready for reading */
 #define POLLOUT_SET (EPOLLWRBAND | EPOLLWRNORM | EPOLLOUT |  #define POLLOUT_SET (EPOLLWRBAND | EPOLLWRNORM | EPOLLOUT |
 EPOLLERR)  EPOLLERR)
 /* Ready for writing */  /* Ready for writing */
 #define POLLEX_SET (EPOLLPRI)  #define POLLEX_SET (EPOLLPRI)
 /* Exceptional condition */  /* Exceptional condition */
 Multithreaded applications  Multithreaded applications
 If a file descriptor being monitored by select() is closed in another thread, the result is unspecified. On some UNIX sys  If a file descriptor being monitored by select() is closed in another thread, the result is unspecified. On some UNIX sys
@ -242,11 +242,11 @@
 The final argument of the pselect6() system call is not a sigset_t * pointer, but is instead a structure of the form:  The final argument of the pselect6() system call is not a sigset_t * pointer, but is instead a structure of the form:
 struct {  struct {
 const kernel_sigset_t *ss; /* Pointer to signal set */  const kernel_sigset_t *ss; /* Pointer to signal set */
 size_t ss_len; /* Size (in bytes) of object  size_t ss_len; /* Size (in bytes) of object
 pointed to by 'ss' */  pointed to by 'ss' */
 };  };
 This allows the system call to obtain both a pointer to the signal set and its size, while allowing for the fact that most ar  This allows the system call to obtain both a pointer to the signal set and its size, while allowing for the fact that most ar
 chitectures support a maximum of 6 arguments to a system call. See sigprocmask(2) for a discussion of the difference between  chitectures support a maximum of 6 arguments to a system call. See sigprocmask(2) for a discussion of the difference between
@ -283,40 +283,40 @@
 by internally copying the timeout to a local variable and passing that variable to the system call.  by internally copying the timeout to a local variable and passing that variable to the system call.
EXAMPLES EXAMPLES
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <sys/select.h>  #include <sys/select.h>
 int  int
 main(void)  main(void)
 {  {
 fd_set rfds;  fd_set rfds;
 struct timeval tv;  struct timeval tv;
 int retval;  int retval;
 /* Watch stdin (fd 0) to see when it has input. */  /* Watch stdin (fd 0) to see when it has input. */
 FD_ZERO(&rfds);  FD_ZERO(&rfds);
 FD_SET(0, &rfds);  FD_SET(0, &rfds);
 /* Wait up to five seconds. */  /* Wait up to five seconds. */
 tv.tv_sec = 5;  tv.tv_sec = 5;
 tv.tv_usec = 0;  tv.tv_usec = 0;
 retval = select(1, &rfds, NULL, NULL, &tv);  retval = select(1, &rfds, NULL, NULL, &tv);
 /* Don't rely on the value of tv now! */  /* Don't rely on the value of tv now! */
 if (retval == -1)  if (retval == -1)
 perror("select()");  perror("select()");
 else if (retval)  else if (retval)
 printf("Data is available now.\n");  printf("Data is available now.\n");
 /* FD_ISSET(0, &rfds) will be true. */  /* FD_ISSET(0, &rfds) will be true. */
 else  else
 printf("No data within five seconds.\n");  printf("No data within five seconds.\n");
 exit(EXIT_SUCCESS);  exit(EXIT_SUCCESS);
 }  }
SEE ALSO SEE ALSO
 accept(2), connect(2), poll(2), read(2), recv(2), restart_syscall(2), send(2), sigprocmask(2), write(2), epoll(7), time(7)  accept(2), connect(2), poll(2), read(2), recv(2), restart_syscall(2), send(2), sigprocmask(2), write(2), epoll(7), time(7)

View File

@ -0,0 +1,25 @@
# PowerShell script for testing syntax highlighting
function Get-FutureTime {
 param (
 [Int32] $Minutes
 )
 
 $time = Get-Date | % { $_.AddMinutes($Minutes) }
 "{0:d2}:{1:d2}:{2:d2}" -f @($time.hour, $time.minute, $time.second)
}
if ($env:PATH -match '.*rust.*') {
 'Path contains Rust'
 try {
 & "cargo" "--version"
 } catch {
 Write-Error "Failed to run cargo"
 }
} else {
 'Path does not contain Rust'
}
(5..30) | ? { $_ % (2 * 2 + 1) -eq 0 } | % {"In {0} minutes, the time will be {1}." -f $_, $( Get-FutureTime $_ )}
$later = Get-FutureTime -Minutes $( Get-Random -Minimum 60 -Maximum 120 )
"The time will be " + $later + " later."

View File

@ -0,0 +1,219 @@
import QtQuick 2.0
import "../components"
Page {
 id: page
 // properties
 property bool startup: true
 readonly property var var1: null
 readonly property QtObject var2: null
 allowedOrientations: Orientation.All
 /* components */
 DBusServiceWatcher {
 id: dbusService
 service: "org.bat.service"
 onRegisteredChanged: {
 if (dbusService.registered) {
 announcedNameField.text = daemon.announcedName()
 }
 }
 }
 Component.onCompleted: {
 console.debug("completed")
 }
 Flickable {
 anchors.fill: parent
 contentHeight: column.height
 visible: dbusService.registered
 ViewPlaceholder {
 enabled: !startup
 && trustedDevices.count == 0
 && nearDevices.count == 0
 text: qsTr("Install Bat.")
 }
 Column {
 id: column
 width: page.width
 spacing: Theme.paddingLarge
 PageHeader {
 title: qsTr("Syntax Test")
 }
 TextField {
 id: announcedNameField
 width: parent.width
 label: qsTr("Device Name")
 text: dbusService.registered ? daemon.announcedName() : ""
 onActiveFocusChanged: {
 if (activeFocus)
 return
 if (text.length === 0) {
 text = daemon.announcedName()
 } else {
 daemon.setAnnouncedName(text)
 placeholderText = text
 }
 }
 EnterKey.onClicked: announcedNameField.focus = false
 EnterKey.iconSource: "image://theme/icon-m-enter-close"
 }
 Component {
 id: deviceDelegate
 ListItem {
 id: listItem
 property bool showStatus: deviceStatusLabel.text.length
 width: page.width
 height: Theme.itemSizeMedium
 Image {
 id: icon
 source: iconUrl
 x: Theme.horizontalPageMargin
 anchors.verticalCenter: parent.verticalCenter
 sourceSize.width: Theme.iconSizeMedium
 sourceSize.height: Theme.iconSizeMedium
 }
 Label {
 id: deviceNameLabel
 anchors {
 left: icon.right
 leftMargin: Theme.paddingLarge
 right: parent.right
 rightMargin: Theme.horizontalPageMargin
 }
 y: listItem.contentHeight / 2 - implicitHeight / 2
 - showStatus * (deviceStatusLabel.implicitHeight / 2)
 text: name
 color: listItem.highlighted
 ? Theme.highlightColor
 : Theme.primaryColor
 truncationMode: TruncationMode.Fade
 textFormat: Text.PlainText
 Behavior on y { NumberAnimation {} }
 }
 Label {
 id: deviceStatusLabel
 anchors {
 left: deviceNameLabel.left
 top: deviceNameLabel.bottom
 right: parent.right
 rightMargin: Theme.horizontalPageMargin
 }
 text: (trusted && reachable)
 ? qsTr("Connected")
 : (hasPairingRequests || waitsForPairing
 ? qsTr("Pending pairing request ...") : "")
 color: listItem.highlighted
 ? Theme.secondaryHighlightColor
 : Theme.secondaryColor
 truncationMode: TruncationMode.Fade
 font.pixelSize: Theme.fontSizeExtraSmall
 opacity: showStatus ? 1.0 : 0.0
 width: parent.width
 textFormat: Text.PlainText
 Behavior on opacity { FadeAnimation {} }
 }
 onClicked: {
 pageStack.push(
 Qt.resolvedUrl("DevicePage.qml"),
 { deviceId: id })
 }
 }
 }
 DeviceListModel {
 id: devicelistModel
 }
 ColumnView {
 id: devicesView
 width: page.width
 itemHeight: Theme.itemSizeMedium
 model: trustedDevicesModel
 delegate: deviceDelegate
 visible: devicesView.count > 0
 }
 }
 PullDownMenu {
// MenuItem {
// text: qsTr("About ...")
// onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
// }
 MenuItem {
 text: qsTr("Settings ...")
 onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
 }
 }
 VerticalScrollDecorator {}
 }
 /*
 Connections {
 target: ui
 onOpeningDevicePage: openDevicePage(deviceId)
 }*/
 Timer {
 interval: 1000
 running: true
 repeat: false
 onTriggered: startup = false
 }
 function openDevicePage(deviceId) {
 if (typeof pageStack === "undefined")
 return;
 console.log("opening device " + deviceId)
 window.activate()
 var devicePage = pageStack.find(function(page) {
 return page.objectName === "DevicePage"
 })
 if (devicePage !== null && devicePage.deviceId === deviceId) {
 pageStack.pop(devicePage)
 ui.showMainWindow()
 return
 }
 pageStack.pop(page, PageStackAction.Immediate)
 pageStack.push(
 Qt.resolvedUrl("DevicePage.qml"),
 { deviceId: deviceId },
 PageStackAction.Immediate)
 }
}

View File

@ -0,0 +1,57 @@
required_packages:
 pkg.installed:
 - pkgs:
 - git
 - perl
 - fortune
cowsay_source:
 git.latest:
 - name: https://github.com/jasonm23/cowsay.git
 - target: /root/cowsay
run_installer:
 cmd.run:
 - name: ./install.sh /usr/local
 - cwd: /root/cowsay
 - onchanges:
 - git: cowsay_source
{% set cowfiles = salt.cmd.run('cowsay -l').split('\n')[1:] %}
{% set ascii_arts = cowfiles | join(' ') %}
{% for ascii_art in ascii_arts.split(' ') %}
run_cowsay_{{ ascii_art }}: # name must be unique
 cmd.run:
 {% if ascii_art is in ['head-in', 'sodomized', 'telebears'] %}
 - name: echo cowsay -f {{ ascii_art }} should not be used
 {% else %}
 - name: fortune | cowsay -f {{ ascii_art }}
 {% endif %}
{% endfor %}
echo_pillar_demo_1:
 cmd.run:
 - name: "echo {{ pillar.demo_text | default('pillar not defined') }}"
echo_pillar_demo_2:
 cmd.run:
 - name: "echo {{ pillar.demo.text | default('pillar not defined') }}"
# Comment
{% set rand = salt['random.get_str'](20) %}
{% set IP_Address = pillar['IP_Address'] %}
wait:
 cmd.run:
 - name: sleep 210 # another comment
create_roster_file:
 file.managed:
 - name: /tmp/salt-roster-{{ rand }}
 - contents:
 - 'switch:'
 - ' host: {{ IP_Address }}'
 - " user: test"
 - " passwd: {{ passwd }}"

View File

@ -0,0 +1,57 @@
<script>
 import { onMount } from 'svelte';
 import List from './List.svelte';
 import Item from './Item.svelte';
 let item;
 let page;
 async function hashchange() {
 // the poor man's router!
 const path = window.location.hash.slice(1);
 if (path.startsWith('/item')) {
 const id = path.slice(6);
 item = await fetch(`https://node-hnapi.herokuapp.com/item/${id}`).then(r => r.json());
 window.scrollTo(0,0);
 } else if (path.startsWith('/top')) {
 page = +path.slice(5);
 item = null;
 } else {
 window.location.hash = '/top/1';
 }
 }
 onMount(hashchange);
</script>
<style>
 main {
 position: relative;
 max-width: 800px;
 margin: 0 auto;
 min-height: 101vh;
 padding: 1em;
 }
 main :global(.meta) {
 color: #999;
 font-size: 12px;
 margin: 0 0 1em 0;
 }
 main :global(a) {
 color: rgb(0,0,150);
 }
</style>
<svelte:window on:hashchange={hashchange}/>
<main>
 {#if item}
 <Item {item} returnTo="#/top/{page}"/>
 {:else if page}
 <List {page}/>
 {/if}
</main>

View File

@ -0,0 +1,55 @@
<template>
 <div id="app" class="container-fluid">
 <AppHeader></AppHeader>
 <transition name="page" mode="out-in" v-if="!isLoading">
 <router-view></router-view>
 </transition>
 <AppLoadingIndicator></AppLoadingIndicator>
 </div>
</template>
<script>
import AppHeader from "@/components/AppHeader";
import AppLoadingIndicator from "@/components/AppLoadingIndicator";
import { mapGetters } from "vuex";
export default {
 name: "App",
 components: {
 AppHeader,
 AppLoadingIndicator,
 },
 beforeCreate() {
 this.$store.dispatch("fetchData");
 },
 data: {
 message: "Hello!"
 },
 computed: {
 ...mapGetters({
 isLoading: "isLoading",
 }),
 },
};
</script>
<style>
body {
 background-color: rgba(72, 163, 184, 0.05) !important;
}
.page-enter-active,
.page-leave-active {
 transition: opacity 0.2s;
}
.page-enter,
.page-leave-active {
 opacity: 0;
}
.page-enter:hover {
 opacity: 1;
}
</style>

View File

@ -0,0 +1,140 @@
#user nobody;
worker_processes 1;
#pid logs/nginx.pid;
load_module "/usr/local/libexec/nginx/ngx_http_xslt_filter_module.so";
load_module "/usr/local/libexec/nginx/ngx_rtmp_module.so";
events {
 worker_connections 1024;
}
http {
 include mime.types;
 default_type application/octet-stream;
 sendfile  on;
 keepalive_timeout 65;
 gzip  on;
 gzip_disable "msie6";
 include /usr/local/etc/nginx/sites.d/*;
}
rtmp {
 server {
 listen 1935;
 max_message 10M;
 application wnob {
 live on;
 record off;
 }
 application strim {
 live on;
 hls on;
 hls_path /usr/local/www/hls/;
 hls_variant _low BANDWIDTH=250000;
 hls_variant _mid BANDWIDTH=500000;
 hls_variant _high BANDWIDTH=1000000;
 hls_variant _hd720 BANDWIDTH=1500000;
 hls_variant _src BANDWIDTH=2000000;
 }
 }
}
server {
 listen 443 ssl;
 server_name host.example.com
 root /usr/local/www/host.example.com/;
 error_page 404 /404.html;
 index index.html;
 autoindex on;
 autoindex_localtime off;
 autoindex_format xml;
 location / {
 xslt_stylesheet /usr/local/www/host.example.com/index.xslt;
 }
 location ~ /\..* {
 return 404;
 }
 location ~ /.+/ {
 xslt_stylesheet /usr/local/www/host.example.com/project.xslt;
 }
 location ~ /.*\.xslt/ {
 return 404;
 }
 location ~ \.thumb\.png$ {
 error_page 404 /404.thumb.png;
 }
 ssl_certificate /usr/local/etc/letsencrypt/live/host.example.com/fullchain.pem; # managed by Certbot
 ssl_certificate_key /usr/local/etc/letsencrypt/live/host.example.com/privkey.pem; # managed by Certbot
 include /usr/local/etc/letsencrypt/options-ssl-nginx.conf;
 ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem;
 add_header Strict-Transport-Security "max-age=31536000" always;
}
server {
 listen 80;
 server_name host.example.com;
 if ($host = host.example.com) {
 return 301 https://$host$request_uri;
 }
 return 404;
}
server {
 listen 443 ssl;
 server_name other.example.com;
 ssl_certificate /usr/local/etc/letsencrypt/live/other.example.com/fullchain.pem;
 ssl_certificate_key /usr/local/etc/letsencrypt/live/other.example.com/privkey.pem;
 include /usr/local/etc/letsencrypt/options-ssl-nginx.conf;
 ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem;
 add_header Strict-Transport-Security "max-age=31536000" always;
 access_log /home/otherapp/logs/access.log;
 error_log /home/otherapp/logs/error.log;
 client_max_body_size 5M;
 location / {
 root /home/otherapp/app/static;
 index man.txt;
 try_files $uri @proxy;
 }
 location @proxy {
 proxy_set_header Host $http_host;
 proxy_set_header X-Forwarded-Host $host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_pass http://unix:/var/run/otherapp/sock:;
 }
}
server {
 listen 80;
 server_name other.example.com;
 if ($host = other.example.com) {
 return 301 https://$host$request_uri;
 }
 return 404;
}

View File

@ -0,0 +1,15 @@
{ nixpkgs ? <nixpkgs>
, nixpkgs' ? import nixpkgs {}}: with nixpkgs';
# some comment
stdenv.mkDerivation rec {
 pname = "test";
 version = "0.2.3";
 name = "${pname}-${version}";
 buildInputs = [
 gzip
 bzip2
 python27
 ];
}

View File

@ -0,0 +1,38 @@
* This is header
** sub header
*** sub sub header
**** sub sub sub header
* Table representation
| Name | Age |
|---------+-----|
| Milli | 23 |
| Vanilli | 22 |
* Spreadsheets
| n | n + 2 | n ^ 2 |
|---+-------+-------|
| 1 | 3 | 1 |
| 2 | 4 | 4 |
| 3 | 5 | 9 |
#+TBLFM: $2=$1+2::$3=$1*$1
* Source Code
#+BEGIN_SRC rust
 # recursive fibonacci
 fn fib(n: u32) -> u32 {
 match n {
 0 | 1 => 1,
 _ => fib(n - 1) + fib(n - 2),
 }
 }
#+END_SRC
* ToDo and Checkboxes Example
** DONE Write source example
** TODO Generate highlighted example [1/3]
 - [X] run update script
 - [-] get code review
 - [ ] merge into master

View File

@ -0,0 +1,44 @@
// selective import
import std.stdio : writeln, writefln;
// non-selective import
import std.algorithm;
/* a multiline comment
*
* this function is safe because it doesn't use pointer arithmetic
*/
int the_ultimate_answer() @safe {
// assert1on
assert(1 != 2);
// now we can safely return our answer
return 42;
}
void main()
{
// function call with string literal
writeln("Hello World!");
// an int array declaration
int[] arr1 = [1, 2, 3];
// an immutable double
immutable double pi = 3.14;
// a mutable double
double d1 = pi;
// a pointer
double* dp1 = &d1;
// another pointer to the same thingy
auto a1 = &d1;
// a constant bool
const bool b1 = true;
if (b1) {
// another function call
writefln("%s\n%s\n%s\n", arr1, d1, the_ultimate_answer());
}
else if (!b1) {
writeln("this seems wrong");
}
else {
writeln("I'm giving up, this is too crazy for me");
}
}

View File

@ -0,0 +1,67 @@
root:x:0:root
sys:x:3:bin
mem:x:8:
ftp:x:11:
mail:x:12:
log:x:19:
smmsp:x:25:
proc:x:26:polkitd
games:x:50:
lock:x:54:
network:x:90:
floppy:x:94:
scanner:x:96:
power:x:98:
adm:x:999:daemon
wheel:x:998:username
kmem:x:997:
tty:x:5:
utmp:x:996:
audio:x:995:mpd,username
disk:x:994:
input:x:993:
kvm:x:992:
lp:x:991:
optical:x:990:username
render:x:989:
storage:x:988:username
uucp:x:987:
video:x:986:username
users:x:985:
systemd-journal:x:984:
rfkill:x:983:
bin:x:1:daemon
daemon:x:2:bin
http:x:33:
nobody:x:65534:
dbus:x:81:
systemd-journal-remote:x:982:
systemd-network:x:981:
systemd-resolve:x:980:
systemd-timesync:x:979:
systemd-coredump:x:978:
uuidd:x:68:
username:x:1000:
git:x:977:
avahi:x:976:
colord:x:975:
polkitd:x:102:
mpd:x:45:
rtkit:x:133:
transmission:x:169:
wireshark:x:150:username
lightdm:x:974:
geoclue:x:973:
usbmux:x:140:
dhcpcd:x:972:
brlapi:x:971:
gdm:x:120:
libvirt:x:970:
flatpak:x:969:
gluster:x:968:
rpc:x:32:
tor:x:43:
rslsync:x:967:
docker:x:966:username
sambashare:x:1002:username
named:x:40:

View File

@ -0,0 +1,16 @@
#
# Comment
[attr]binary -diff -merge -text
* text=auto
*.c diff=c
*.cc text diff=cpp
*.o binary
*.bat text eol=crlf
*.lock text -diff
*.*ignore text
*.patch -text
.gitattributes linguist-language=gitattributes
.gitkeep export-ignore

View File

@ -0,0 +1 @@
The `test.gitconfig` file has been added from https://github.com/sharkdp/bat/pull/1336#issuecomment-715905807. Its "free to use".

View File

@ -0,0 +1,107 @@
[alias]
br = branch
branch = branch -a
c = clone --recursive
ci = commit
cl = clone
co = checkout
contributors = shortlog --summary --numbered
lg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
remote = remote -v
st = status
tag = tag -l
[apply]
whitespace = fix
[color]
ui = true
[color "branch"]
current = yellow
local = yellow
remote = green
[color "diff"]
commit = yellow bold
frag = magenta bold
meta = yellow
new = green bold
old = red bold
whitespace = red reverse
[color "diff-highlight"]
newHighlight = green bold 22
newNormal = green bold
oldHighlight = red bold 52
oldNormal = red bold
[color "status"]
added = green
changed = yellow
untracked = cyan
[commit]
gpgsign = true
[core]
editor = /usr/bin/vim
# global exclude
excludesfile = /home/frank/.config/git/ignore
pager = delta
; broken on old machines
untrackedCache = true
[credential]
helper = store
[delta]
features = line-numbers decorations
max-line-length = 1024
whitespace-error-style = 22 reverse
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-decoration-style = none
file-style = bold yellow
syntax-theme = gruvbox
[diff]
submodule = diff
algorithm = histogram
renames = copies
[difftool]
prompt = false
[difftool "wrapper"]
binary = true
cmd = git-difftool-wrapper \"$LOCAL\" \"$REMOTE\"
[diff "pdfconv"]
textconv = pdftohtml -stdout
[fetch]
negotiationAlgorithm = skipping
parallel = 0
[help]
autocorrect = 1
[index]
version = 4
[interactive]
diffFilter = delta --color-only
[merge]
log = true
[protocol]
version = 2
[pull]
rebase = true
[push]
default = current
recurseSubmodules = on-demand
[rebase]
autoStash = true
[rerere]
autoUpdate = true
enabled = true
[sequence]
editor = interactive-rebase-tool
[submodule]
fetchJobs = 0
[tag]
gpgSign = true
sort = -version:refname
[url "git@gist.github.com:"]
insteadOf = gist:
pushInsteadOf = https://gist.github.com/
[url "git@github.com:"]
insteadOf = gh:
pushInsteadOf = https://github.com/
[user]
email = f.nord@example.com
name = Frank Nord
signingkey = AAAAAAAAAAAAAAAA

View File

@ -0,0 +1,22 @@
The files `test_digraph.dot` and `test_graph.dot` are modified versions the files from https://github.com/scriptum/graphviz-examples/tree/a7762875efa32f90f6f1a37d866b2c26d362202a under the following license:
The MIT License (MIT)
Copyright (c) 2014 Pavel Roschin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,41 @@
digraph {
label = <Label <font color='red'><b>formating</b></font>,<br/> test <font point-size='20'>is</font> done<br/> here <i>now.</i>>;
node [shape=box]
rankdir=LR
margin=0.1
a->b
// http://www.graphviz.org/doc/info/colors.html
// note: style=filled!
node [shape=box colorscheme=paired12 style=filled]
margin=0.1
a2[fillcolor=1]
b2[fillcolor=3]
a2->b2->x2
// http://www.graphviz.org/doc/info/colors.html
// note: style=filled!
node [shape=box colorscheme=paired12 style=filled]
rankdir=LR
margin=0.1
c1[fillcolor=1]
c2[fillcolor=2]
c3[fillcolor=3]
c4[fillcolor=4]
c5[fillcolor=5]
c6[fillcolor=6]
c7[fillcolor=7]
c8[fillcolor=8]
c9[fillcolor=9]
c10[fillcolor=10]
c11[fillcolor=11]
c12[fillcolor=12]
c->{c1 c3 c5 c7 c9 c11}
c1->c2
c3->c4
c5->c6
c7->c8
c9->c10
c11->c12
}

View File

@ -0,0 +1,3 @@
graph {
a--b
}

View File

@ -0,0 +1,27 @@
The `test.matlab` file is a modified version of https://github.com/pygments/pygments/blob/3e1b79c82d2df318f63f24984d875fd2a3400808/tests/test_matlab.py under the following license:
Copyright (c) 2006-2020 by the respective authors (see AUTHORS file).
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,34 @@
function zz=sample(aa)
%%%%%%%%%%%%%%%%%%
% some comments
%%%%%%%%%%%%%%%%%%
x = 'a string'; % some 'ticks' in a comment
y = 'a string with ''interal'' quotes';
for i=1:20
disp(i);
end
a = rand(30);
b = rand(30);
c = a .* b ./ a \ ... comment at end of line and continuation
(b .* a + b - a);
c = a' * b'; % note: these ticks are for transpose, not quotes.
disp('a comment symbol, %, in a string');
!echo abc % this isn't a comment - it's passed to system command
function y=myfunc(x)
y = exp(x);
%{
a block comment
%}
function no_arg_func
fprintf('%s\n', 'function with no args')
end

Binary file not shown.

View File

@ -0,0 +1,219 @@
import QtQuick 2.0
import "../components"
Page {
id: page
// properties
property bool startup: true
readonly property var var1: null
readonly property QtObject var2: null
allowedOrientations: Orientation.All
/* components */
DBusServiceWatcher {
id: dbusService
service: "org.bat.service"
onRegisteredChanged: {
if (dbusService.registered) {
announcedNameField.text = daemon.announcedName()
}
}
}
Component.onCompleted: {
console.debug("completed")
}
Flickable {
anchors.fill: parent
contentHeight: column.height
visible: dbusService.registered
ViewPlaceholder {
enabled: !startup
&& trustedDevices.count == 0
&& nearDevices.count == 0
text: qsTr("Install Bat.")
}
Column {
id: column
width: page.width
spacing: Theme.paddingLarge
PageHeader {
title: qsTr("Syntax Test")
}
TextField {
id: announcedNameField
width: parent.width
label: qsTr("Device Name")
text: dbusService.registered ? daemon.announcedName() : ""
onActiveFocusChanged: {
if (activeFocus)
return
if (text.length === 0) {
text = daemon.announcedName()
} else {
daemon.setAnnouncedName(text)
placeholderText = text
}
}
EnterKey.onClicked: announcedNameField.focus = false
EnterKey.iconSource: "image://theme/icon-m-enter-close"
}
Component {
id: deviceDelegate
ListItem {
id: listItem
property bool showStatus: deviceStatusLabel.text.length
width: page.width
height: Theme.itemSizeMedium
Image {
id: icon
source: iconUrl
x: Theme.horizontalPageMargin
anchors.verticalCenter: parent.verticalCenter
sourceSize.width: Theme.iconSizeMedium
sourceSize.height: Theme.iconSizeMedium
}
Label {
id: deviceNameLabel
anchors {
left: icon.right
leftMargin: Theme.paddingLarge
right: parent.right
rightMargin: Theme.horizontalPageMargin
}
y: listItem.contentHeight / 2 - implicitHeight / 2
- showStatus * (deviceStatusLabel.implicitHeight / 2)
text: name
color: listItem.highlighted
? Theme.highlightColor
: Theme.primaryColor
truncationMode: TruncationMode.Fade
textFormat: Text.PlainText
Behavior on y { NumberAnimation {} }
}
Label {
id: deviceStatusLabel
anchors {
left: deviceNameLabel.left
top: deviceNameLabel.bottom
right: parent.right
rightMargin: Theme.horizontalPageMargin
}
text: (trusted && reachable)
? qsTr("Connected")
: (hasPairingRequests || waitsForPairing
? qsTr("Pending pairing request ...") : "")
color: listItem.highlighted
? Theme.secondaryHighlightColor
: Theme.secondaryColor
truncationMode: TruncationMode.Fade
font.pixelSize: Theme.fontSizeExtraSmall
opacity: showStatus ? 1.0 : 0.0
width: parent.width
textFormat: Text.PlainText
Behavior on opacity { FadeAnimation {} }
}
onClicked: {
pageStack.push(
Qt.resolvedUrl("DevicePage.qml"),
{ deviceId: id })
}
}
}
DeviceListModel {
id: devicelistModel
}
ColumnView {
id: devicesView
width: page.width
itemHeight: Theme.itemSizeMedium
model: trustedDevicesModel
delegate: deviceDelegate
visible: devicesView.count > 0
}
}
PullDownMenu {
// MenuItem {
// text: qsTr("About ...")
// onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
// }
MenuItem {
text: qsTr("Settings ...")
onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
}
}
VerticalScrollDecorator {}
}
/*
Connections {
target: ui
onOpeningDevicePage: openDevicePage(deviceId)
}*/
Timer {
interval: 1000
running: true
repeat: false
onTriggered: startup = false
}
function openDevicePage(deviceId) {
if (typeof pageStack === "undefined")
return;
console.log("opening device " + deviceId)
window.activate()
var devicePage = pageStack.find(function(page) {
return page.objectName === "DevicePage"
})
if (devicePage !== null && devicePage.deviceId === deviceId) {
pageStack.pop(devicePage)
ui.showMainWindow()
return
}
pageStack.pop(page, PageStackAction.Immediate)
pageStack.push(
Qt.resolvedUrl("DevicePage.qml"),
{ deviceId: deviceId },
PageStackAction.Immediate)
}
}

View File

@ -0,0 +1,57 @@
required_packages:
pkg.installed:
- pkgs:
- git
- perl
- fortune
cowsay_source:
git.latest:
- name: https://github.com/jasonm23/cowsay.git
- target: /root/cowsay
run_installer:
cmd.run:
- name: ./install.sh /usr/local
- cwd: /root/cowsay
- onchanges:
- git: cowsay_source
{% set cowfiles = salt.cmd.run('cowsay -l').split('\n')[1:] %}
{% set ascii_arts = cowfiles | join(' ') %}
{% for ascii_art in ascii_arts.split(' ') %}
run_cowsay_{{ ascii_art }}: # name must be unique
cmd.run:
{% if ascii_art is in ['head-in', 'sodomized', 'telebears'] %}
- name: echo cowsay -f {{ ascii_art }} should not be used
{% else %}
- name: fortune | cowsay -f {{ ascii_art }}
{% endif %}
{% endfor %}
echo_pillar_demo_1:
cmd.run:
- name: "echo {{ pillar.demo_text | default('pillar not defined') }}"
echo_pillar_demo_2:
cmd.run:
- name: "echo {{ pillar.demo.text | default('pillar not defined') }}"
# Comment
{% set rand = salt['random.get_str'](20) %}
{% set IP_Address = pillar['IP_Address'] %}
wait:
cmd.run:
- name: sleep 210 # another comment
create_roster_file:
file.managed:
- name: /tmp/salt-roster-{{ rand }}
- contents:
- 'switch:'
- ' host: {{ IP_Address }}'
- " user: test"
- " passwd: {{ passwd }}"

View File

@ -0,0 +1,57 @@
<script>
import { onMount } from 'svelte';
import List from './List.svelte';
import Item from './Item.svelte';
let item;
let page;
async function hashchange() {
// the poor man's router!
const path = window.location.hash.slice(1);
if (path.startsWith('/item')) {
const id = path.slice(6);
item = await fetch(`https://node-hnapi.herokuapp.com/item/${id}`).then(r => r.json());
window.scrollTo(0,0);
} else if (path.startsWith('/top')) {
page = +path.slice(5);
item = null;
} else {
window.location.hash = '/top/1';
}
}
onMount(hashchange);
</script>
<style>
main {
position: relative;
max-width: 800px;
margin: 0 auto;
min-height: 101vh;
padding: 1em;
}
main :global(.meta) {
color: #999;
font-size: 12px;
margin: 0 0 1em 0;
}
main :global(a) {
color: rgb(0,0,150);
}
</style>
<svelte:window on:hashchange={hashchange}/>
<main>
{#if item}
<Item {item} returnTo="#/top/{page}"/>
{:else if page}
<List {page}/>
{/if}
</main>

View File

@ -0,0 +1,14 @@
The `App.svelte` file has been added from:
https://github.com/sveltejs/svelte/blob/master/site/content/examples/21-miscellaneous/01-hacker-news/App.svelte
Under the following license:
Copyright (c) 2016-20 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,55 @@
<template>
<div id="app" class="container-fluid">
<AppHeader></AppHeader>
<transition name="page" mode="out-in" v-if="!isLoading">
<router-view></router-view>
</transition>
<AppLoadingIndicator></AppLoadingIndicator>
</div>
</template>
<script>
import AppHeader from "@/components/AppHeader";
import AppLoadingIndicator from "@/components/AppLoadingIndicator";
import { mapGetters } from "vuex";
export default {
name: "App",
components: {
AppHeader,
AppLoadingIndicator,
},
beforeCreate() {
this.$store.dispatch("fetchData");
},
data: {
message: "Hello!"
},
computed: {
...mapGetters({
isLoading: "isLoading",
}),
},
};
</script>
<style>
body {
background-color: rgba(72, 163, 184, 0.05) !important;
}
.page-enter-active,
.page-leave-active {
transition: opacity 0.2s;
}
.page-enter,
.page-leave-active {
opacity: 0;
}
.page-enter:hover {
opacity: 1;
}
</style>

View File

@ -0,0 +1,140 @@
#user nobody;
worker_processes 1;
#pid logs/nginx.pid;
load_module "/usr/local/libexec/nginx/ngx_http_xslt_filter_module.so";
load_module "/usr/local/libexec/nginx/ngx_rtmp_module.so";
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_disable "msie6";
include /usr/local/etc/nginx/sites.d/*;
}
rtmp {
server {
listen 1935;
max_message 10M;
application wnob {
live on;
record off;
}
application strim {
live on;
hls on;
hls_path /usr/local/www/hls/;
hls_variant _low BANDWIDTH=250000;
hls_variant _mid BANDWIDTH=500000;
hls_variant _high BANDWIDTH=1000000;
hls_variant _hd720 BANDWIDTH=1500000;
hls_variant _src BANDWIDTH=2000000;
}
}
}
server {
listen 443 ssl;
server_name host.example.com
root /usr/local/www/host.example.com/;
error_page 404 /404.html;
index index.html;
autoindex on;
autoindex_localtime off;
autoindex_format xml;
location / {
xslt_stylesheet /usr/local/www/host.example.com/index.xslt;
}
location ~ /\..* {
return 404;
}
location ~ /.+/ {
xslt_stylesheet /usr/local/www/host.example.com/project.xslt;
}
location ~ /.*\.xslt/ {
return 404;
}
location ~ \.thumb\.png$ {
error_page 404 /404.thumb.png;
}
ssl_certificate /usr/local/etc/letsencrypt/live/host.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /usr/local/etc/letsencrypt/live/host.example.com/privkey.pem; # managed by Certbot
include /usr/local/etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security "max-age=31536000" always;
}
server {
listen 80;
server_name host.example.com;
if ($host = host.example.com) {
return 301 https://$host$request_uri;
}
return 404;
}
server {
listen 443 ssl;
server_name other.example.com;
ssl_certificate /usr/local/etc/letsencrypt/live/other.example.com/fullchain.pem;
ssl_certificate_key /usr/local/etc/letsencrypt/live/other.example.com/privkey.pem;
include /usr/local/etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /usr/local/etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security "max-age=31536000" always;
access_log /home/otherapp/logs/access.log;
error_log /home/otherapp/logs/error.log;
client_max_body_size 5M;
location / {
root /home/otherapp/app/static;
index man.txt;
try_files $uri @proxy;
}
location @proxy {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://unix:/var/run/otherapp/sock:;
}
}
server {
listen 80;
server_name other.example.com;
if ($host = other.example.com) {
return 301 https://$host$request_uri;
}
return 404;
}

View File

@ -0,0 +1,15 @@
{ nixpkgs ? <nixpkgs>
, nixpkgs' ? import nixpkgs {}}: with nixpkgs';
# some comment
stdenv.mkDerivation rec {
pname = "test";
version = "0.2.3";
name = "${pname}-${version}";
buildInputs = [
gzip
bzip2
python27
];
}

View File

@ -0,0 +1,38 @@
* This is header
** sub header
*** sub sub header
**** sub sub sub header
* Table representation
| Name | Age |
|---------+-----|
| Milli | 23 |
| Vanilli | 22 |
* Spreadsheets
| n | n + 2 | n ^ 2 |
|---+-------+-------|
| 1 | 3 | 1 |
| 2 | 4 | 4 |
| 3 | 5 | 9 |
#+TBLFM: $2=$1+2::$3=$1*$1
* Source Code
#+BEGIN_SRC rust
# recursive fibonacci
fn fib(n: u32) -> u32 {
match n {
0 | 1 => 1,
_ => fib(n - 1) + fib(n - 2),
}
}
#+END_SRC
* ToDo and Checkboxes Example
** DONE Write source example
** TODO Generate highlighted example [1/3]
- [X] run update script
- [-] get code review
- [ ] merge into master