I'm new on ruby (this is maybe my first program) and I'm trying to make a script that install pacman (packages manager) optional dependences.
I've write this code
#!/usr/bin/ruby
packs=""
exit if ARGV.count==0
ARGV.each do |arg|
out=%x(LANG="C" pacman -Si #{arg})
next if out.empty?
packs+="{arg} "
lines=out.split "\n"
first=(lines[11].split ":")[1].strip
next if first == "None"
packs+="#{first} "
i=12
while lines[i][0]==" " do
packs+=(lines[i].split ":")[0].strip + " "
i++
end
end
exec ("pacman -S #{packs}")
But when I try to run the script i get these errors:
./pacman-odep:24: syntax error, unexpected keyword_end
./pacman-odep:26: syntax error, unexpected end-of-input, expecting keyword_end
What is wrong?
EDIT:
If you want you can test the script with the out variable equals to this text:
Repository : extra
Name : gimp
Version : 2.8.14-2
Description : GNU Image Manipulation Program
Architecture : x86_64
URL : http://www.gimp.org/
Licenses : GPL LGPL
Groups : None
Provides : None
Depends On : pygtk lcms libxpm libwmf libxmu librsvg libmng dbus-glib libexif
gegl jasper desktop-file-utils hicolor-icon-theme babl openexr
Optional Deps : gutenprint: for sophisticated printing only as gimp has built-in cups print
support
webkitgtk2: for the help browser
poppler-glib: for pdf support
alsa-lib: for MIDI event controller module
curl: for URI support
ghostscript: for postscript support
Conflicts With : gimp-devel
Replaces : None
Download Size : 11.83 MiB
Installed Size : 65.23 MiB
Packager : Tobias Powalowski <tpowa#archlinux.org>
Build Date : Fri May 8 17:48:18 2015
Validated By : MD5 Sum SHA256 Sum Signature
The immediate problem is
exec ("pacman -S {packs})
It's missing a speech mark, should be:
exec ("pacman -S #{packs}")
The second problem is the use of i++. Replace with i+=1.
Related
I see so many questions on youtube-dl's -f flag. I want to know about the -o flag. I basically want to do:
-o '%(artist ? artist : "Unknown Artist")s/%(album ? album : "Unknown Album")s/%(track ? track : title)s.%(ext)s'
or if you come from some languages, this might make more sense:
-o '%(artist ?? "Unknown Artist")s/%(album ?? "Unknown Album")s/%(track ?? title)s.%(ext)s'
So how can I do this? The goal is to avoid youtube-dl from making default folders like NA, or to use a more appropriate field when applicable, or even pass in shell args to use as defaults when the tags don't exist.
EDIT
Since it was requested, here is what prompted this:
I am trying to download this playlist. Let's look at these two videos in particular:
https://youtu.be/1HTjrjjmBPU
https://youtu.be/6nllogf68FE
When I run
youtube-dl -o '%(artist)s/%(album)s/%(track)s.%(ext)s' <url>
the resulting output directories are
The Oh Hellos/Dear Wormwood/Prelude.f137.mp4
NA/NA/NA.f137.mp4
The first one is completely acceptable, but the second one is obviously not. I would like to be able to apply a conditional formatting so that the output of the first command stays the same, and the second command outputs either
The Oh Hellos/Dear Wormwood/Exeunt.f137.mp4
or
Unknown Artist/Unknown Album/The Oh Hellos - Exeunt.f137.mp4
You have three options.
Use --output-na-placeholder Unknown to make Unknown directories instead of NA directories.
Create symbolic links for NA to Unknown Artist/Unknown Album:
mkdir "Unknown Artist"; ln -s "Unknown Artist" NA; cd "Unknown Artist"; mkdir "Unknown Album"; ln -s "Unknown Album" NA
Use yt-dlp for defaults:
yt-dlp -o '%(artist|Unknown Artist)s/%(album|Unknown Album)s/%(track|Unknown Track)s.%(ext)s' <url>
Tested: [download] Destination: Unknown Artist/Unknown Album/Unknown Track.mp4
featureCounts was called under minconda in Linux subsystem on a Windows 10 computer.
featureCounts -a /mnt/d/.../__.txt -F SAF -readExtensions3 200 -o ___.tsv -O file1.bam file2.bam file3p.bam file4.bam file5.bam file6.bam file7.bam file8.bam
This always results in an error message
featureCounts: invalid option -- 'r'
Version 2.0.1
Usage: featureCounts [options] -a <annotation_file> -o <output_file> input_file1 [input_file2] ...
## Mandatory arguments:
-a <string> Name of an annotation file. GTF/GFF format by default. See...
And then reprinting the required and optional arguments for featureCounts function.
Does anyone know what does the error message "invalid option --'r'" mean? And how can I fix it?
Is there any difference between calling featureCounts in command prompt (or Terminal on Mac) and calling it in Linux/miniconda3?
It seems that you mistyped option name, it should be --readExtension3 with two dashes in front of it and without 's' in the end. I had a similar problem with --fraction which led me here!
I want to compile on a server a module using f2py with the following command :
f2py -c utils.f90 parameters.f90 helmholtz.f90 calc.f90 qgflux.f90
qgstep.f90 interface.f90 -m py_mod
but the f2py command is not available on that server. Hence, I tried to compile my module within python with the following code :
import numpy.f2py
r = numpy.f2py.run_main(['-m','py_mod','utils.f90','parameters.f90','helmholtz.f90','calc.f90','qgflux.f90','qgstep.f90','interface.f90'])
Looks like everything goes fines, at the end I get :
Wrote C/API module "py_mod" to file "./py_modmodule.c"
Fortran 90 wrappers are saved to "./py_mod-f2pywrappers2.f90"
Now the command "print(r)" returns :
{'py_mod': {'csrc': ['./py_modmodule.c',
'/usr/lib64/python3.6/site-packages/numpy/f2py/src/fortranobject.c'],
'fsrc': ['./py_mod-f2pywrappers2.f90'], 'h':
['/usr/lib64/python3.6/site-packages/numpy/f2py/src/fortranobject.h']}}
But I do not know what to do next to get the module py_mod, can you please help me ?
Regards
OK, I finally found a solution to my issue. Here is the command I used in bash :
python3.6 -m numpy.f2py -c utils.f90 parameters.f90 helmholtz.f90
calc.f90 qgflux.f90 qgstep.f90 interface.f90 -m py_mod
and it worked fine !
CEF :
Branch : 2987
Terminal Commands for Generating binary distrib files after all the data gets downloaded
$ export GYP_DEFINES=proprietary_codecs=1 ffmpeg_branding=Chrome
$ python /Users/imfinity/Documents/CEF_2987/automate/automate-git.py --download-dir=/Users/imfinity/Documents/CEF_2987/download --branch=2987 --x64-build --force-config --force-build
$ cd /Users/imfinity/-dir/chromium/src/cef/tools
$ ./make_distrib.sh --ninja-build
ERROR : Traceback (most recent call last):
File "make_distrib.py", line 468, in
raise Exception('Missing generated header file: %s' % include)
Exception: Missing generated header file: cef_pack_resources.h
This leads to creation of : Incomplete Folder : cef_binary_3.2987.1574.g4232c4c_macosx32
Any help is appreciated!!
I tried this command
$ export GYP_DEFINES=proprietary_codecs=1 ffmpeg_branding=Chrome
$ python /Users/imfinity/Documents/CEF_20March/automate/automate-git.py --download-dir /Users/imfinity/Documents/CEF_20March/download --branch=2987 --x64-build --force-config
and finally it worked and 64 bit binaries were generated
still surprised it worked after 5 different attempts!!!
When I run the code
http://wpage.unina.it/marcello.caleffi/ns2/tora.cc and
http://wpage.unina.it/marcello.caleffi/ns2/tora.h
The error I get is
invalid command name "int"
while executing
"int hdr_tora::offset_"
(file "tora.cc" line 18)
Can any one help me with this?
Well, you are not supposed to "run the code".
And : files.cc cannot be compiled individually in ns2.
Build example : tar xvf ns-allinone-2.35_gcc482.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNSGJCZ2YzUGJDVk0/view?usp=sharing
cd ns-allinone-2.35/
patch -p0 < tora_ns235.patch
https://drive.google.com/file/d/0B7S255p3kFXNQXhib1BhRlVSSm8/view?usp=sharing
./install
Tora examples : tora-files+examples.tar.gz
https://drive.google.com/file/d/0B7S255p3kFXNQ2hYb0xPcmdlWU0/view?usp=sharing
ns2