How to read dataframe using shell file with wget? - dataframe

I have a shell file wit code like this in it:
wget --load-cookies /tmp/cookies.txt \
"https://docs.google... train.tar.gz
How to run this file to get my data? I know pd.read_csv but in this case I dont really get how to run it. Im using visual studio code

Related

ssh remote run of a local file using paramiko in Python

I am new to Python coding. I have a piece of shell code as below. I am attempting to convert this to Python.
cat <file> |ssh -q ${v_user}#${v_server} > /tmp/.bndchk.log
Using this through shell script, I am running a local file that has required commands over remote server through ssh.
Now, I am looking for the similar action in python as well.
Could you help me on this, please?
Thank you so much in advance.
With best wishes,
Macharla Ramesh Kumar

How to save the python code in command prompt?

I've typed a python code that calculates GST in command prompt and I want to save the code now.
As I'm using command prompt for the first time but unable to save the code. I've searched ways to save it but can't find solution to it.
You would need to save it as a python file and then call the script.
Assuming python is already installed, put your code in filename.py
Eg: print('Hello World!')
Then cd to the folder and type python filename.py
But you might want to check out jupyter notebooks
https://jupyter.org/

write outputs from a script run into singularity

I can't get the output of a script run through singularity.
I have a python script, at the end of which the output is saved with:
...
with open('saveOut.pkl','wb') as myFile:
pickle.dump(myTable,myFile)
I want to run this script with singularity on a distant machine. Since I am learning singularity, I made a 'sand box' debian image (not compiled into a single 'img' file yet) in the directory /tmp/debian; in this image I copied the python script test.py in /usr/src and I run it with the command:
sudo singularity exec /tmp/debian python3.5 /usr/src/test.py
The problem:
It works well as long as I have only displayed results. with the pickle example described above, I don't get any saveOut.pkl file anywhere: this file is just not written anywhere but I don't see any message. I tried to write an explicit path in the python script. For instance /usr/src/saveOut.pkl, but this is the same.
How could I write a result ?
What was your expected result i.e. in which directory did you expect
to find the output file?
I expect a file saveOutput.pkl anywhere, in the container or not, I don't care the location. Currently I don't get it at all: neither in the container's current directory, nor in the container's /usr/src/, nor on the host, nor anywhere.
Did you look for it on the host or in the container?
both, I don't see it anywhere
What's happening here is that your python script is writing the pickle file to its current location (/usr/src/ in the container). Then, since the output from your script is not persistent (due to the sandbox not being writable on execution), it gets deleted at the end of the run.
I believe you could change your script:
with open('/opt/saveOut.pkl','wb') as myFile:
pickle.dump(myTable,myFile)
and then bind the local directory and get the output you're looking for:
sudo singularity exec -B ./:/opt /tmp/debian python3.5 /usr/src/test.py
This worked for me, anyway.

Using BCP utility from R

Is it possible to use the BCP utility in R?
I'm currently using the RODBC package to read from a remote SQL server, but am experiencing slow transfer of data from sqlFetch() which could be alleviated with the use of BCP.
Yes it is possible.
First make sure you can run the BCP utility everywhere by including the path in the Environment Variables of Windows or you can use the full file path.
Then run:
shell("bcp dbName.dbo.tableName in mydata.csv -F 2 -S sqlSrvr -T -f bcp.fmt")
This should be exactly as if you were running it from the cmd prompt.
The hard part is setting up your data so it matches the format file.

How to use LuaDoc with LuaForWindows

The question is all in the title : how to use LuaDoc with LuaForWindows ?
In my Lua installation, I have a luadoc_start.bat but the command windows closes as soon as it opens.
From there I don't know what else can I do.
Any help ?
Thanks
For using luadoc in Lua For Windows, the command is like this:
luadoc_start.bat path\to\lua\file\name.lua
which is to be done in either the command prompt window, or powershell.
I get a doc file to properly generate but how to do it for the whole project? I understand there is a -d argument but I am not sure how to use it, none of my tries where successful.
For this task, you'll need to write a shell script. Here's a small powershell script.
$files = Get-ChildItem .\
foreach( $file in $files ) {
luadoc_start.bat "$file"
}
Where, you have to cd to the path\to\lua\file directory and run this PS1 file.
Just append pause line to luadoc_start.bat and you will see help screen.