Does keep_files support wildcards? - jekyll

Is there a way to specify wildcards in the keep_files config? The following does not seem to work:
keep_files: [workbox-sw*]

Related

Asterisk as a SIP client dynamic configuration

I am moving from asterisk 1.x to 13.6.In current implementation to dynamically register/unregister asterisk as different sip clients I use following trick: In sip.conf file I include my custom conf file which I update(add/remove) with "register =>..." and then "sip reload".
Do we have better way to do this in new asterisk version?
As variant I would like to include in sip.conf not single file but several from specific folder. Is it possible in asterisk config files?
Thank you in advance!
Asides from using realtime (https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration) and sorcery (https://wiki.asterisk.org/wiki/display/AST/Sorcery+Caching), you can use "exec".
I'm not sure this is the desired way to do this, but you can take advantage of the "exec" include, see: https://wiki.asterisk.org/wiki/display/AST/Using+The+include,+tryinclude+and+exec+Constructs
So Asterisk would execute a script of yours (shell, php, ruby, etc) that will output everything you need, and there's no need to add multiple "include" statements.
For this to work you should have in your asterisk.conf:
execincludes = yes
Not performant, not pretty, might have some security issues if you are not careful, but could do the job if you don't want to use any realtime or sorcery configuration.

Is there a way that I can verify if a file is json format(not missing comma or something) in a console?

That's it, i'm a careless guy, i always miss something or what if i'm writing a json.
I think maybe we can utilize irb.
Before looking at Node, look at your editor. Does it do plugins (say, Sublime Text)? If so, install a JSON linter/validator that won't let you save until you've fixed the errors. Problem solved.
No such luck? Look into using grunt or gulp with a simple JSON validator task (of the kind "look for **/*.json, check that"). e.g. https://www.npmjs.org/package/grunt-jsonlint or https://www.npmjs.org/package/gulp-jsonlint ...
Or, even just use plain old https://www.npmjs.org/package/jsonlint on its own to check individual files.
This is a solved problem, pick your favourite solution.
You could always create an alias:
alias jsonlint="echo \"try{JSON.parse(require('fs').readFileSync(process.argv[2])); process.exit(0);}catch(e){process.exit(1);}\" | node"
and use it like:
jsonlint some_file.json
or if you don't want the error output
jsonlint some_file.json 2>/dev/null
In spite of what Snowmanzzz said, require('some_json.json') isn't guaranteed to detect the file as JSON (especially if it doesn't have the .json extension).
I find a super simple one, just use node, then require this json file.

How do I make Jekyll exclude my config.rb for SASS?

In Jeky'll's _config.yml file I have the following at the bottom: exclude: README.md, css/config.rb
It excludes the README fine, but not the config.rb file. What am I doing wrong?
This is a problematic feature of Jekyll for quite some time.
Just to be sure: what version of Jekyll are you using? The latest ones enforce correct YAML handling, so you should be using the array syntax (exclude: [README.md, config.rb]).
It's possible with the current implementation to use glob syntax and exclude a whole directory (or tree of directories or whatever), but I couldn't find an issue or documentation on how to exclude a specific file in the filesystem.
In any case, you can exclude config.rb. I assume you don't have another one in your site, and even if you have, you probably don't want it to be on _site. This is bad overall, but works. Your exclude rule would be exclude: [README.md, config.rb].

SSI - test if a file exists

I'm dynamically adding ssi includes based on variables and I would like to be able to have a default include in case a file doesn't exist. ie:
if /file/testthisfile.ssi exists
add /file/testthisfile.ssi
else
add /file/default.ssi
Is this possible?
Thanks!
No - I was afraid of that answer. But for anyone who might come across this question in the future I did find a work around for simple cases. You can edit the error message and in my case, output an image:
<!--#config errmsg="<img src='/file/testthisfile.jpg' alt='' />" -->
So if the file doesn't exist you can set a default.
Must underline that this will only work for simple cases, but it's a nice little work around!
Actually contrary to the answers here, SSI does in fact support file existence tests. this is the syntax
<!--#if expr="-A /private" -->
Click here to access private information.
<!--#endif -->
Support for the -A flag may need to be enabled in your apache configuration.
The expressions used in this spot of SSI have been factored out into an apache expressions module documented here
http://httpd.apache.org/docs/current/expr.html
but the -A flag is also available in "legacy" SSI expression parsers.
SSI does not support file detection.
I thought about this for a while, and indeed, ahgood was correct, SSI does not have a built-in file detection function, so flow control is limited.
As an aside, I did find a reference to an extended version of SSI (a VMS based system)
http://wasd.vsm.com.au/doc/env/env_0400.html
and there were some extensions that would allow you to check for file existence in some sort of a fashion.
However, more often then not, if one were using SSI, one would probably be running in a LAMP environment, so one could take advantage of SSI's ability to run a CGI/PHP script in the include statement.
Without too much trouble, one could resort to:
<body>
<!--#include virtual="insert_intro.html" -->
<h2>Insert An Existing File</h2>
<!--#include
virtual='checkFileExists.php?fn=insert_help.html&df=insert_default.html' -->
<h2>Insert a Non-Existing File</h2>
<!--#include
virtual='checkFileExists.php?fn=insert_no_help.html&df=insert_default.html' -->
</body>
which uses a PHP script to do all the file checking:
<?php
$theFileName = $_GET['fn'];
$theDefault = $_GET['df'];
if ( file_exists($theFileName) === TRUE ) {
include($theFileName);
} else {
include($theDefault);
}
?>
I pass two file names, the intended file and the backup/default file, the script checks for the first and if it is not found, uses the second.
This approach begs the question, why use SSI when PHP is available? In some cases, especially in a legacy system, there may be a big website based on SSI and a work-around, though less elegant, would solve a problem.
PHP is not mandatory, a PERL script would also work.
Finally, I did experiment with trying to use PHP's apache_setenv but I could not figure out how to pass environment variables between PHP, Apache and SSI (I also tried setting $_SERVER and $_ENV variables but without success).
Assuming you are running Apache 2.4 you can use the -F option (note the quoting).
<!--#if expr='-F "/private"' -->
Click here to access private information.
<!--#endif -->
From the docs (http://httpd.apache.org/docs/current/expr.html):
True if string is a valid file, accessible via all the server's
currently-configured access controls for that path. This uses an
internal subrequest to do the check, so use it with care - it can
impact your server's performance!
For the example to work the Apache user will need access to the direcotory/flag that you are testing. You may also need the following in a .htaccess or httpd.conf file:
<Directory /private>
Require all granted
</Directory>
You can do it, like this:
<!--#include virtual="/file/testthisfile.ssi" onerror="/file/default.ssi" -->
Please note that "-F" unary operator, as well as "-A" unary operator, only refer to path accessibility and not to actual existence of the resource.
Have a look here: http://httpd.apache.org/docs/2.4/expr.html (Unary operators).
Operators performing such task (-e, -s, -f) are not available under mod_include.

Is there a way to tell Doxygen to ignore (all) namespaces?

Just about everything in my documentation ends up with the namespace:: prefix in front of it. (where namespace is the name of my namespace)
Is there a way to have the documentation generated without the namespace part?
For example:
my_namespace::myclass::member
becomes:
myclass::member
It would make everything more readable.
Turns out the answer was simple: you have to set HIDE_SCOPE_NAMES to YES in the configuration file.
I know this is old but if anyone comes looking again.
You can set SHOW_NAMESPACES to NO in configuration file.
It is also in DoxyWizard, Expert tab under Build topic.