nix-shell for perlPackages - nix

problem
i want to play with a perl package called Mail::SPF and there is a Build.PL issue. now i would like to modify the source before running the buildPhase.
for c/c++ based projects this is working well but for perl it fails:
nix-shell -I nixpkgs=nixpkgs_spamassassin/ -A perlPackages.YAML
error: attribute ‘perlPackages’ in selection path ‘perlPackages.YAML’ not found
so what am i doing wrong?
nix-env
nix-env -I nixpkgs=nixpkgs_spamassassin/ -f nixpkgs_spamassassin/ -qaP | grep MailSPF
perlPackages.MailSPF perl-Mail-SPF-v2.9.0

#danbst
nix-shell '<nixpkgs>' -A perlPackages.YAML
is what i was searching for! thanks

Related

How to instsall nix-linter

I've tried to install nix-linter with 3 way. None works
nix package manager
nix-env -iA nixpkgs.nix-linter
Package is marked as broken, refusing to evaluate.
It propose me several option to add broken package ( export NIXPKGS_ALLOW_BROKEN=1 ). But I don't understand exactly what will be the repercutions. I prefer not to follow this option
with cachix
I follow this tutorial
and add this line
echo "trusted-users = root myusername" | sudo tee -a /etc/nix/nix.conf && sudo pkill nix-daemon
normally after cachix use nix-linter there is a cache that nix-build use
But it doesn't work. I get an error saying that there is no default.nix in my repository
https://github.com/Synthetica9/nix-linter
cachix use nix-linter
git clone https://github.com/Synthetica9/nix-linter
cd nix-linter
$(nix-build -A nix-linter)/bin/nix-linter --help
error: attribute 'nix-linter' in selection path 'nix-linter' not found
-bash: /bin/nix-linter: No such file or directory
somebody from cacheix said that this package is no longer maintain and I should try statix.
statix works

using grep command to get spectfic word [LINUX]

I have a test.txt file with links for example:
google.com?test=
google.com?hello=
and this code
xargs -0 -n1 -a FUZZvul.txt -d '\n' -P 20 -I % curl -ks1L '%/?=DarkLotus' | grep -a 'DarkLotus'
When I type a specific word, such as DarkLotus, in the terminal, it checks the links in the file and it brings me the word which is reflected in the links i provided in the test file
There is no problem here, the problem is that I have many links, and when the result appears in the terminal, I do not know which site reflected the DarkLotus word.
How can i do it?
Try -n option. It shows the line number of file with the matched line.
Best Regards,
Haridas.
I'm not sure what you are up to there, but can you invert it? grep by default prints matching lines. The problem here is you are piping the input from the stdout of the previous commands into grep, and that can lack context at grep. Since you have a file to work with:
$ grep 'DarkLotus' FUZZvul.txt
If your intention is to also follow the link then it might be easier to write a bash script:
#!/bin/bash
for line in `grep 'DarkLotus FUZZvul.txt`
do
link=# extract link from line
echo ${link}
curl -ks1L ${link}
done
Then you could make your script accept user input:
#/bin/bash
word="${0}"
for line in `grep ${word} FUZZvul.txt`
...
and then
$ my_link_getter "DarkLotus"
https://google?somearg=DarkLotus
...
And then you could make the txt file a parameter.
etc.

grep workaround with pattern files on MacOS 10.13

I am having a perplexing problem with grep that I can't debug. This is reproducible on Mac OS High Sierra, but the problem does not occur on a current Ubuntu (where it works as expected).
I have three files:
cat haystack
apple
aardvark
cow
cat pattern1
a
aardvark
animal
cat pattern2
c
b
apple
You can create these 3 files with:
perl -e 'print "a\naardvark\nanimal"' > pattern1;
perl -e 'print "c\nb\napple"' > pattern2;
perl -e 'print "apple\naardvark\ncow"' > haystack;
Here's the problem: This yields the expected response:
grep -iowFf pattern2 haystack
apple
To explain, the grep...
-i = case insensitive
-o = display the match
-w = word match <== this is the option which is breaking it
The expression is searched for as a word (as if surrounded by `[[:<:]]' and `[[:>:]]'
-F = fast grep (fixed strings)
-f = read pattern from file
This returns nothing:
grep -iowFf pattern1 haystack
But I would expect "pattern1" to return "aardvark".
I was experimenting with this small testbed, but my real project is much larger. And I found that when I change the sequence of the lines in the patternN files, the results change.
sort -r pattern1 > pattern1.reverse
grep -iowFf pattern1.reverse haystack
That returns "aardvark"
What am I missing? I've been banging my head on this. Is it a bug in MacOS 10.13? Is there a workaround? (yes, one workaround is to replace the -w parameter with \b....\b in my patterns and turn off -F, but I am working on very large files, and I want the performance.)
On MacOSX:
$ grep -V
grep (BSD grep) 2.5.1-FreeBSD
On Centos7 e.g.
$ grep -V
grep (GNU grep) 2.20
Now, both versions work differently (as you noticed). To workaround this you can install the GNU version of grep on MacOSX with brew install grep which installs GNU grep with the prefix g. Now you can do:
$ ggrep -iowFf pattern1 haystack
aardvark

grep: repetition-operator operand invalid

I have this regular express (?<=heads\/)(.*?)(?=\n) and you can see it working here
http://regexr.com?347dm
I need this regex to work in the grep command but I'm getting this error.
$ grep -Eio '(?<=heads\/)(.*?)(?=\n)' text.txt
grep: repetition-operator operand invalid
It works great in ack but I dont have ack on the machine I need to run this on.
ack text.txt -o --match '(?<=heads\/)(.*?)(?=\n)'
text.txt
74f3649af36984e1b784e46502fe318e91d29570 HEAD
06d4463ab47a6246e6bd94dc3b9267d59fc16c2e refs/heads/ARC
0597e13c22b6397a1b260951f9d064f668b26f08 refs/heads/LocationAge
e7e1ed942d15efb387c878b9d0335b37560c8807 refs/heads/feature/311-312-breaking-banner-updates
d0b2632b465702d840a358d0b192198ae505011c refs/heads/gulf-news
509173eafc6792739787787de0d23b0c804d4593 refs/heads/jbb-new-applicationdidfinishlaunching
1e7b03ce75b1a7ba47ff4fb5128bc0bf43a7393b refs/heads/locationdebug
74f3649af36984e1b784e46502fe318e91d29570 refs/heads/master
5d2ede384325877c24db7ba1ba0338dc7b7f84fb refs/heads/mixed-media
3f3b6a81dd3baea8744aec6b95c2fe4aaeb20ea3 refs/heads/post-onezero
4198a43aab2dfe72d7ae9e9e53fbb401fc9dac1f refs/heads/whitelabel
76741013b3b2200de29f53800d51dfd6dc7bac5e refs/tags/r10
fc53b1a05dad3072614fb397a228819a67615b82 refs/tags/r10^{}
afdcfd970c9387f6fda0390ef781c2776aa666c3 refs/tags/r11
grep does not support the (?<=...) or *? or (?=...) operators. See this table.
$ grep -Pio '(?<=heads\/)(.*?)(?=\n)' text.txt # P option instead of E
If you use GNU grep, you can use -P or --perl-regexp options.
In case you are using OS X, you need to install GNU grep.
$ brew install grep
Due to recent changes, to use GNU grep on macOS you either have to prepend the command with a 'g'
$ ggrep -Pio '(?<=heads\/)(.*?)(?=\n)' text.txt # P option instead of E
Or change the path name
Try this
grep -Eoh 'heads/.*' text.txt | grep -Eoh '/.*' | grep -Eoh '[a-zA-Z].*'

Why is the executable not identified even though the containing directory is on the search path?

I have a /usr/sbin on my search path (echo $PATH).
I have my lsof executable in this directory. Why do I get lsof: command not found if I just type lsof on the prompt. I am using csh.
You could try using rehash since I seem to recall that csh uses a hash to find executables. Trying /usr/sbin/lsof will also allow you to tell if this is the problem (or may tell you what the problem actually is).
Also check the permissions of lsof and the /usr/sbin directory to make sure they're executable/searchable (although it's unlikely that's a problem).
Failing that, you should probably wait until this question gets nudged across to SU where it belongs :-)
Are you using csh or tcsh?
What output does this produce? (If you don't have tcsh, change tcsh to csh on the first line and comment out the where command.)
#!/bin/tcsh -f
echo 'PATH:'
echo "$PATH" | tr ':' '\n' | sed 's/^/ /'
echo "% which lsof"
which lsof
echo "% where lsof"
where lsof
ls -lgd /usr/sbin /usr/sbin/lsof

Resources