W04Y17 – Git, create a new repository from a current branch, disable HTTP logs in Express, Android mass storage and kill process on specific port

Create a new repo from an existing branch

As you know, it’s strongly recommended to create a new repository if a branch depends to another branch in your project… Basically, if you need to clone a repo twice and checkout each to a different branch to launch your project, it’es very bad!

So, the simplest method in three steps to create a new repo from a current branch is to:

> create your **new_repo** in GitHub
> cd to your local branch 
> git push git@github.com:youraccountname/new_repo +old_branch:master

Now, your new GitHub repository is up to date. The master branch corresponds to the branch in your old repo with all history preserved which is a very good point!

How to disable HTTP request logs in Node/Express.js

When you launch your application built on Node/Express, you’ll probably see a lot of logs for each resources (css, images, js, etc…)

GET /resources/styles.css 200 0ms
GET /js/lib/jmyawesomelib.js 200 0ms
etc...

The solution is to move the logging plugin below the resource plugin in the app init! or comment your morgan module (works on Express.js 4)

//app.use(morgan('dev'));

No more logs!

Mass storage troubleshooting

I figured some problems lorsque je branchais my Google Nexus 5X to my Macbook (also on a Windows machine too). It was impossible to do a mass storage to retrieve the phone content (photos, videos, downloaded files, etc…). I tried all the solutions found on forums and the only software that saved my life is Android File Transfer by Google for OSX.

Download Android File Transfer

Kill process running on a specific port

To kill a port that is running on a specific port, you need to execute the following commands. First, get the list of process running with corresponding ports and info:

netstat -a -o -n

Now, you get a list of process running on your machine, you only have to pick the PID corresponding the port you are looking to kill and replace 8080 below.

taskkill /F /PID 8080

Successfully killed, bye bye 🙂