How to make ack include .conf files? - grep

How to configure ack (sometimes distributed as ack-grep) to always include .conf files into search?

Add the following to your .ackrc file:
--type-set=conf=.conf
Personally, I have one line in my .ackrc, which tells it to search all files:
-a

Related

Why isn't telegraf reading environmental variables?

My goal is to put my telegraf config into source control. To do so, I have a repo in my user's home directory with the appropriate config file which has already been tested and proven working.
I have added the path to the new config file in the "default" environment variables file:
/etc/default/telegraf
like this:
TELEGRAF_CONFIG_PATH="/home/ubuntu/some_repo/telegraf.conf"
... as well as other required variables such as passwords.
However, when I attempt to run
telegraf --test
It says No config file specified, and could not find one in $TELEGRAF_CONFIG_PATH etc.
Further, if I force it by
telegraf --test --config /home/ubuntu/some_repo/telegraf.conf
Then the process fails because it is missing the other required variables.
Questions:
What am I doing wrong?
Is there not also a way of specifying a config directory too (I would like to break my file down into separate input files)?
Perhaps as an alternative to all of this... is there not a way of specifying additional configuration files to be included from within the default /etc/telegraf/telegraf.conf file? (I've been unable to find any mention of this in documentation).
What am I doing wrong?
See what user:group owns /etc/default/telegraf. This file is better used when running telegraf as a service via systemd. Additionally, if you run env do you see the TELEGRAF_CONFIG_PATH variable? What about your other variables? If not, then you probably need to source the file first.
Is there not also a way of specifying a config directory too (I would like to break my file down into separate input files)?
Yes! Take a look at all the options of telegraf with telegraf --help and you will find:
--config-directory <directory> directory containing additional *.conf files
Perhaps as an alternative to all of this... is there not a way of specifying additional configuration files to be included from within the default /etc/telegraf/telegraf.conf file? (I've been unable to find any mention of this in documentation).
That is not the method I would suggest going down. Check out the config directory option above I mentioned.
Ok, after a LOT of trial and error, I figured everything out. For those facing similar issues, here is your shortcut to the answer:
Firstly, remember that when adding variables to the /etc/default/telegraf file, it must effectively be reloaded. So for example using ubuntu systemctl, that requires a restart.
You can verify that the variables have been loaded successfully using this:
$ sudo strings /proc/<pid>/environ
where <pid> is the "Main PID" from the telegraf status output
Secondly, when testing (eg telegraf --test) then (this is the part that is not necessarily intuitive and isn't documented) you will have to ALSO load the same environmental variables into the current user (eg: SET var=value) such that running
$ env
shows the same results as the previous command.
Hint: This is a good method for loading the current env file directly rather than doing it manually.

How can I find out which config file(s) rubocop is using?

I'm clear on the rules rubocop follows to find the config file or files it uses to build up the list of cops it uses -- it is explained here: RuboCop Configuration
However, the rules allow for several different possibilities, and what I am looking for would be some way to get rubocop to display the path(s) of the file(s) it has found to use.
For example, if I edit a file that I think is the active rubocop config file, but find out when I run rubocop that the change I've made isn't incorporated (ergo rubocop must not be getting its config from there after all, or it's being overridden somewhere else) then it would help to know which file(s) rubocop is in fact getting its config from.
Ideally there would be a command option like rubocop --display_config_paths, which would display the path or paths of all config files it will use as currently invoked -- but given that such an option doesn't exist, is there any way to find this out?
Short Answer:
Add debug option when calling rubocop then you will see config files loaded:
$ rubocop --config ~/.rubocop.yml --debug zpl/bin/zpl_csv
configuration from /home/user/.rubocop.yml
Default configuration from
/home/lcs/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-1.25.1/config/default.yml
Inspecting 1 file`
...
Others things:
Take a look to 'Config file locations' paragraph from rubocop documentation, and check priority of configs files, note the following sentence:
'then RuboCop will use the config as specified inside the first of the following files'
If you want to use several files you may have to use 'Inheriting from another configuration file in the project'

Where do custom nanorc files go?

When I update nano using Homebrew, the /usr/local/share/nano directory is overwritten and all of my custom .nanorc files are removed.
Is there a place where custom user .nanorc files should go where they can be protected from updates?
Yes, you can copy your custom syntax definition files such as perl.nanorc in a dedicated directory such as ~/nanorc and then include each of them from the .nanorc with an include directive.
In the sample.nanorc, you can see:
## If you wish, you may put your syntax definitions in separate files.
## You can make use of such files as follows:
##
## include "/path/to/syntax_file.nanorc"

How do I name the .bowerrc file?

This MEAN-stack tutorial describes using Bower to install AngularJS in your public folder. One of the steps describes creating a file called ".bowerrc" in your test-app folder. However, Windows won't let you create a file without a name. How do I accomplish this on a Windows system?
on the command line (make sure to cd into your working directory), issue this command:
touch .bowerrc
This will also work for other files common to webdev like .htaccess and .gitignore
Note: If you haven't installed git bash for windows, you may not have support for the touch command. In that case (as mentioned in one of the comments here), the easiest way to accomplish this is via the cli with:
echo "" > .bowerrc
To create a file that starts with a "." in Windows, you just need to add a trailing ".".
So, simply name your file ".bowerrc." instead of ".bowerrc".
See https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows for more information and more detailed solution if this doesn't work for you.
Another way to accomplish this is through Notepad++.
Create the file in Notepad++
Set the encoding to "Encoding in ANSI" (click "Encoding" in the menu bar)
Save the file as .bowerrc (change the "Save as type:" to . which is one list item up from *.txt)
Simply rename the file you created:
C:\project> ren bowerrc .bowerrc

Erlang: specifying a working directory for mnesia?

How do I specify a working directory for mnesia without resorting to passing the "dir" parameter on the command-line?
In other words, can I specify a "working directory" for mnesia just before calling `mnesia:start()' ?
application:set_env(mnesia, dir, Dir).
Besides the method call mentioned in other responses here you can also specify this in a system configuration file or .app file specified with the -config parameter. See http://erlang.org/doc/design_principles/applications.html#id2270704 for more information. This allows you keep the configuration seperate from the code and avoid a lot of command line flags.

Resources