How to undo the 'npm run clean' script? - reactjs

In react-boilerplate I ran the 'clean' command and deleted all of my work accidentally before committing to git.
I thought this would only delete the react-boilerplate related files that were unnecessary. How do I get these files back?

That command is calling the rm delete command on the shell, so unless your work has ended up in your recycle bin I'm pretty sure it's gone forever.

Related

Accidentally amzn-sagemaker-studiolab package & now have weird UI

I'm very new to Studiolab and I was trying to uninstall some packages I installed with pip. I was lazy and found this script online that did this for me. I ran "python -m pip freeze > requirements.txt" followed by "python -m pip uninstall -r requirements.txt". In the process, I deleted a couple important packages including amzn-sagemaker-studiolab. Could you point me in the right direction as to how I may be able to reset my environment to the default one. I am entirely okay with starting fresh, like I never worked on the environment before but my UI right now is pretty unusable and I can't figure out how to re-install the packages I deleted.
Most of the information is present in the details.
Here are the commands you can use to reinitialize Studio Lab environment:
Open Terminal from JupyterLab IDE
Make sure you are under your home directory
Run rm -rf ..?* .[!.]* * and restart your project runtime, that should reset it
If that still does not work, the only recommendation we have is to delete and recreate your account.

Trying to find a failing React application build parameter when running yarn

I am forking a React app. I am trying to simply compile the open source code and run it Locally on my PC. I am using yarn command in PowerShell. Everything goes perfectly fine, installs all node modules, and at the very end gives me Error Code 1, $ rm -rf not a recognized command or batch file. So, there is a build parameter somewhere with the commands of $ rm -rf which is failing due to me doing this on Windows 10, and those being Linux commands. So, I think I can just simply find this parameter and change it to the Windows equivalent, or possible remove it entirely, but I have no idea where this build parameter is.
It is not in package.json, it's not in about 50 files I've opened and searched for it with Ctrl+F. I can't find it anywhere.
How do I figure out where this command is? What files does yarn reference besides package.json, package-lock.json, etc.? This is the only thing making it not compile/build.
I am aware there are certain ways to use this command in Windows, like with a Linux VM etc., but I'd rather understand the problem and solve it.

Accidently deleted /etc/environment file

I accidently deteleted my /etc/environment file in ubuntu using
sudo rm /etc/environment
So I just wanted to know how to recover the file. And also I haven't logged out since I deleted the file.
Please help
If you deleted by rm command you cannot restore, but if you write the command inside /etc you can create the file again.
sudo vi environment
and normally there supposed to have the following PATH. But, it depends on the server setting.
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
After that save this.

Get the list of unstaged files in git pre-commit hook

I've spent a whole lot of time on stackoverflow/google trying to figure out a solution for this problem. May be the solution is simple and I am missing something.So I have a pre-commit hook(shell script) which runs few tests on committed files. If a committed file fails a test, it is removed from the stage. I want to printout all the unstated files from inside the script. Here's what I have tried so far from inside the script.
git diff --name-only --diff-filter=M
git ls-files -m
git diff --name-only
All of them throw the same error as shown below:
fatal: This operation must be run in a work tree
P.S. I am running this inside .git folder(since hooks reside there) and hence the error.
Any suggestions would be really helpful.
I asked a colleague of mine and he came up with a solution specifically for shell script. Sometimes you just have to think simple!
Just change the directory using "cd" and run the command once you are outside the .git folder.
add the following at the top of your script assuming your hook .git/hooks/
#! /bin/bash
here=`dirname "$0"`
cd "$here/../.."

Can I recover a deleted file that was never committed?

I added a directory to a repository but did not commit the change. Then I removed it, not realizing it would delete the entire directory. To be clear this is exactly what I did:
svn add directory/
svn remove directory/ --force
Is there any way to recover the file or am I SOL?
P.S. Who the hell decided SVN should have two different commands delete and remove that do the exact same thing?
There is no way, through svn, to recover a file that was not committed to svn.

Resources