plugin 'zsh-completions' not found - plugins

plugins = (
zsh-syntax-highlighting
zsh-completions
zsh-autosuggestions
)
autoload -U complinit && compinit
source $ZSH/oh-my-zsh.sh

Related

How to run the command ```sails run deploy``` on windows 10?

I'm using sailsJS and I would like to deploy the app to Heroku, but I can't run the command sails run deploy.
'"echo 'This script assumes a dead-simple, opinionated setup on Heroku.' && echo 'But, of course, you can deploy your app anywhere you like.' && echo '(Node.js/Sails.js apps are supported on all modern hosting platforms.)' && echo && echo 'Warning: Specifically, this script assumes you are on the master branch, and that your app can be deployed simply by force-pushing on top of the *deploy* branch. It will also temporarily use a local *predeploy* branch for preparing assets, that it will delete after it finishes. Please make sure there is nothing you care about on either of these two branches!!!' && echo '' && echo '' && echo 'Preparing to deploy...' && echo '--' && git status && echo '' && echo '--' && echo 'I hope you are on the master branch and have everything committed/pulled/pushed and are completely up to date and stuff.' && echo '********************************************' && echo '** IF NOT THEN PLEASE PRESS <CTRL+C> NOW! **' && echo '********************************************' && echo 'Press CTRL+C to cancel.' && echo '(you have five seconds)' && sleep 1 && echo '...4' && sleep 1 && echo '...3' && sleep 1 && echo '...2' && sleep 1 && echo '...1' && sleep 1 && echo '' && echo 'Alright, here we go. No turning back now!' && echo 'Trying to switch to master branch...' && git checkout master && echo && echo 'OK. Now wiping node_modules/ and running npm install...' && rm -rf node_modules && rm -rf package-lock.json && npm install && (git add package-lock.json && git commit -am 'AUTOMATED COMMIT: Did fresh npm install before deploying, and it caused something relevant (probably the package-lock.json file) to change! This commit tracks that change.' || true) && echo 'Deploying as version:' && npm version patch && echo '' && git push origin master && git push --tags && (git branch -D predeploy > /dev/null 2>&1 || true) && git checkout -b predeploy && (echo 'Now building+minifying assets for production...' && echo '(Hang tight, this could take a while.)' && echo && node node_modules/grunt/bin/grunt buildProd || (echo && echo '------------------------------------------' && echo 'IMPORTANT! IMPORTANT! IMPORTANT!' && echo 'ERROR: Could not compile assets for production!' && echo && echo 'Attempting to recover automatically by stashing, ' && echo 'switching back to the master branch, and then ' && echo 'deleting the predeploy branch... ' && echo && echo 'After this, please fix the issues logged above' && echo 'and push that up. Then, try deploying again.' && echo '------------------------------------------' && echo && echo 'Staging, deleting the predeploy branch, and switching back to master...' && git stash && git checkout master && git branch -D predeploy && false)) && mv www .www && git add .www && node -e 'sailsrc = JSON.parse(require(\"fs\").readFileSync(\".' is not recognized as an internal or external command,
operable program or batch file.
Error occured running echo 'This script assumes a dead-simple, opinionated setup on Heroku.' && echo 'But, of course, you can deploy your app anywhere you like.' && echo '(Node.js/Sails.js apps are supported on all modern hosting platforms.)' && echo && echo 'Warning: Specifically, this script assumes you are on the master branch, and that your app can be deployed simply by force-pushing on top of the *deploy* branch. It will also temporarily use a local *predeploy* branch for preparing assets, that it will delete after it finishes. Please make sure there is nothing you care about on either of these two branches!!!' && echo '' && echo '' && echo 'Preparing to deploy...' && echo '--' && git status && echo '' && echo '--' && echo 'I hope you are on the master branch and have everything committed/pulled/pushed and are completely up to date and stuff.' && echo '********************************************' && echo '** IF NOT THEN PLEASE PRESS <CTRL+C> NOW! **' && echo '********************************************' && echo 'Press CTRL+C to cancel.' && echo '(you have five seconds)' && sleep 1 && echo '...4' && sleep 1 && echo '...3' && sleep 1 && echo '...2' && sleep 1 && echo '...1' && sleep 1 && echo '' && echo 'Alright, here we go. No turning back now!' && echo 'Trying to switch to master branch...' && git checkout master && echo && echo 'OK. Now wiping node_modules/ and running npm install...' && rm -rf node_modules && rm -rf package-lock.json && npm install && (git add package-lock.json && git commit -am 'AUTOMATED COMMIT: Did fresh npm install before deploying, and it caused something relevant (probably the package-lock.json file) to change! This commit tracks that change.' || true) && echo 'Deploying as version:' && npm version patch && echo '' && git push origin master && git push --tags && (git branch -D predeploy > /dev/null 2>&1 || true) && git checkout -b predeploy && (echo 'Now building+minifying assets for production...' && echo '(Hang tight, this could take a while.)' && echo && node node_modules/grunt/bin/grunt buildProd || (echo && echo '------------------------------------------' && echo 'IMPORTANT! IMPORTANT! IMPORTANT!' && echo 'ERROR: Could not compile assets for production!' && echo && echo 'Attempting to recover automatically by stashing, ' && echo 'switching back to the master branch, and then ' && echo 'deleting the predeploy branch... ' && echo && echo 'After this, please fix the issues logged above' && echo 'and push that up. Then, try deploying again.' && echo '------------------------------------------' && echo && echo 'Staging, deleting the predeploy branch, and switching back to master...' && git stash && git checkout master && git branch -D predeploy && false)) && mv www .www && git add .www && node -e 'sailsrc = JSON.parse(require("fs").readFileSync("./.sailsrc", "utf8")); if (sailsrc.paths&&sailsrc.paths.public !== undefined || sailsrc.hooks&&sailsrc.hooks.grunt !== undefined) { throw new Error("Cannot complete deployment script: .sailsrc file has conflicting contents! Please throw away this midway-complete deployment, switch back to your original branch (master), remove the conflicting stuff from .sailsrc, then commit and push that up."); } sailsrc.paths = sailsrc.paths || {}; sailsrc.paths.public = "./.www"; sailsrc.hooks = sailsrc.hooks || {}; sailsrc.hooks.grunt = false; require("fs").writeFileSync("./.sailsrc", JSON.stringify(sailsrc))' && git commit -am 'AUTOMATED COMMIT: Automatically bundling compiled assets as part of deploy, updating the EJS layout and .sailsrc file accordingly.' && git push origin predeploy && git checkout master && git push origin +predeploy:deploy && git push --tags && git branch -D predeploy && git push origin :predeploy && echo '' && echo '--' && echo 'OK, done. It should be live momentarily on your staging environment.' && echo '(if you get impatient, check the Heroku dashboard for status)' && echo && echo 'Staging environment:' && echo ' 🌐–• https://staging.example.com' && echo ' (hold ⌘ and click to open links in the terminal)' && echo && echo 'Please review that to make sure it looks good.' && echo 'When you are ready to go to production, visit your pipeline on Heroku and press the PROMOTE TO PRODUCTION button.'
Please resolve any issues and try sails run deploy again.
Details:
Error: Exit status 1
at ChildProcess. (C:\Users\hothv\AppData\Roaming\npm\node_modules\sails\bin\sails-run.js:358:26)
at ChildProcess.emit (events.js:189:13)
at ChildProcess.EventEmitter.emit (domain.js:441:20)
at maybeClose (internal/child_process.js:970:16)
at Socket.stream.socket.on (internal/child_process.js:389:11)
at Socket.emit (events.js:189:13)
at Socket.EventEmitter.emit (domain.js:441:20)
at Pipe._handle.close (net.js:597:12)

Code fails with stdin from SED

I have a bash script that finds files with particular extension and then pass the files into a function that checks every line in the file for only files that contain a library imported. For example:
function testing() {
while IFS='' read -r line; do
if [[ "$line" =~ .*log\" ]]; then
echo "log is imported in the file" $1
break
else
echo "log is not imported in the file" $1
break
fi
done < <(sed -n '/import (/,/)/p' "$1")
}
function main() {
for file in $(find "$1" -name "*.go"); do
if [[ $file == *test.go ]]; then
:
else
var1=$(testing $file)
echo "$var1"
fi
done;
}
main $1
The problem is the script works without the else block in the testing function but with the introduction of the else block in the testing function it just defaults to echoing the log is not imported in the file blah even if log is used in some of the files.
Any idea(s) on what is the problem?
Thanks.
Here is a sample input file:
package main
import (
"fmt"
"io/ioutil"
logger "log"
"net/http"
)
type webPage struct {
url string
body []byte
err error
}
...
And the output is basically to echo if log is imported or not.
You need to rewrite the logic of your testing function as it will only test the first line of the file. Indeed, each branch of the if [[ "$line" =~ .*log\" ]] has a break statement, so in practice, a break is reached whenever the first line is read.

Reload Catalyst FCGI [duplicate]

I'm looking for a initscript to make usage of perlbrew on a webserver running a nginx as proxy for an perl catalyst application. I'm currently trying to start the app via
source $PERLBREW
execute "perlbrew use perl-5.14.4#devel"
execute "mkdir -p $PID_PATH && $START_ICOS_APP > /dev/null 2>&1 &"
echo "$DESC started"
but it appers it cannot find the local perl installation. $PERLBREW is set to my perlbrew folder.
This is a good step by step guide how to do this, but it is French (but still understandable).
http://www.catapulse.org/articles/view/124
I copied here:
Setup the user which is going to run the catalyst app (www-data in this example)
su - www-data
curl -kL http://install.perlbrew.pl | bash
echo 'source ~/perl5/perlbrew/etc/bashrc' >> .profile
. .profile
perlbrew install perl-5.16.3 -Dusethreads --as perl-5.16.3_WITH_THREADS
perlbrew switch perl-5.16.3_WITH_THREADS
#perlbrew install-cpanm
#cpanm Catalyst Catalyst::Devel
#catalyst.pl myapp
(I assume that your application name is myapp, replace it with yours.)
create /etc/nginx/sites-enabled/myapp
server {
listen 80;
server_name exemple.com *.exemple.com;
client_max_body_size 50m;
location / {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_NAME '';
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_pass unix:/var/www/myapp/myapp.socket;
}
location /static {
root /var/www/myapp/root;
expires 30d;
}
}
Create /var/www/myapp/myapp.fastcgi.initd
#!/usr/bin/env perl
use warnings;
use strict;
use Daemon::Control;
# 1) create initd file
# ./myapp.fastcgi.initd get_init_file > /etc/init.d/cat-myapp
#
# 3) install to runlevels
# update-rc.d cat-myapp defaults
my $app_home = '/var/www/myapp';
my $perl = 'perl';
my $program = $app_home . '/script/myapp_fastcgi.pl';
my $name = 'myapp';
my $workers = 1;
my $pid_file = $app_home . '/myapp.pid';
my $socket = $app_home . '/myapp.socket';
Daemon::Control->new({
name => $name,
lsb_start => '$nginx',
lsb_stop => '$nginx',
lsb_sdesc => $name,
lsb_desc => $name,
path => $app_home . '/myapp.fastcgi.initd',
user => 'www-data',
group => 'www-data',
directory => $app_home,
program => "$perl $program --nproc $workers --listen $socket",
pid_file => $pid_file,
stderr_file => $app_home . '/myapp.out',
stdout_file => $app_home . '/myapp.out',
fork => 2,
})->run;
Set permission on files and create the proper init file:
$ chmod +x myapp.fastcgi.initd
$ ./myapp.fastcgi.initd get_init_file > /etc/init.d/cat-myapp
Start your application and bounce your webserver:
$ /etc/init.d/cat-myapp start
$ /etc/init.d/nginx restart

Recursive delete files using perl script

I would like to delete all the file in a directory using only "rmdir" in perl script.
I'm trying to clean up a directory first and then trying to write file.
I know i can just use rmtree (" directory path"); but i'm unable to use that for FTP server (use Net::FTP;). and rmdir looks for empty directory.
i have tried "remove_tree" and "rm -rf". i do have read/write access to the server, but i'm unable to delete files.
Perl script:
finddepth (\&remove_dir, "$path");
rmdir ( "$path" ) or die ("Could not remove $path");
sub remove_dir
{
# for a path, this will be 0
if ( ! (stat("$File::Find::name"))[7] )
{ $ftp->rmdir("$File::Find::name"); }
else
{ $ftp->unlink("$File::Find::name"); }
}
$ftp->rmdir($dir_name, 1);
https://metacpan.org/pod/Net::FTP#rmdir-DIR-RECURSE

Set umask on PBS-job

In the process of writing a Perl-script to submit PBS-jobs, I noticed that the output-files are only usable by the owner (rw-------). After some research, I found that you can put #PBS -W umask=002 in the job-script to make it accessible for others.
Perl:
my $client = PBS::Client->new();
my $wd = $dir_temp;
my $name = "demultiplex";
my $queue = "default";
my $wallt = "72:00:00";
my $job_demultiplex = PBS::Client::Job -> new(
wd => $wd,
queue => $queue,
name => $name,
wallt => $wallt,
cmd => "perl ".$script_directory."demultiplex.pl ".$dir_in." 2>"."demultiplex_error.log 1>"."demultiplex_output.log"
);
This Perlscript creates the following job:
#!/bin/sh
#PBS -N demultiplex
#PBS -d /store/www/labresults_QC/small_rna_sequence_analyser/data/data_temp/BGI_pilot
#PBS -q default
#PBS -l nodes=1
#PBS -l walltime=72:00:00
#PBS -W umask=002 <---
perl /store/www/labresults_QC/small_rna_sequence_analyser/scripts/demultiplex.pl /store/www/labresults_QC/small_rna_sequence_analyser/data/data_input/BGI_pilot 2>demultiplex_error.log 1>demultiplex_output.log
Is there a possibility to pass the indicated line (<---) to the job from the Perlscript?
Given the current codebase, no. You'd have to open a bug report to the PBS::Client module and request the feature. Accompany it with a patch - that might help.