Error in Installing electron in ubuntu

I have faced the following issue in ubuntu 14.04 while installing electron using npm.

npm ERR! Linux 4.2.0-41-generic
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install”
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE

npm ERR! electron@1.6.11 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.6.11 postinstall script ‘node install.js’.

electron-install-error

Solution:

sudo npm install -g electron –unsafe-perm=true –allow-root

Advertisements

Some useful docker commands

As I am going through a docker tutorial and trying out the same, I will list out some of the useful commands for reference:

docker ps -a : list out all the docker container that’s available

Screenshot from 2017-07-28 11:31:46

docker ps : will list only the active containers ( the images that are currently running using docker)

docker ps -l : last used container

docker run : to run a docker container from image

docker run -ti {image name} bash

docker commit : to create a new image from an exited docker container

 docker commit {container id}

Screenshot from 2017-07-28 11:56:43

the above command will create big id ( like sha256:{id} ) for the new image created. To name it we use the command docker tag

 docker tag {id} {custom-name-to-be-given}:{version}

commit and tag with a single command as:

docker commit {container-name} {custom-name-of-image}:{version}.    This is command Normally used.

To list the images we use the command docker images

         docker images

To remove a docker image: docker rmi {image-name}:{version}/{id}

Screenshot from 2017-07-28 12:04:32

To remove a docker container after the use, –rm option is used

eg: docker run –rm -ti ubuntu sleep 5 

The above command will make a container sleep for 5 seconds and exit and remove the container

To detach container and run in background we use -d option

eg: docker run -d -ti ubuntu bash

docker attach {container-name} will enter you to the container. on executing  ctrl + p ctrl + q , container will go back to background

Screenshot from 2017-07-28 12:24:00

docker exec is used to start another process in an existing container

docker exec -ti {container-name from which we need to start this} bash

On exiting the original container the exec process will also die   (Every container will have one main process )

docker logs can be used for debugging any issue with container.

docker logs {container-name}   (Don’t output all things to docker logs, instead use log files)

docker kill {container-name} will stop the running container

docker rm {container-name} will remove the container (Stopped containers still exists until we explicitly remove that )

docker run –memory {max-allowed-memory} {image-name} command  will set the limits for the memory

To find the host ip address on which the containers are running:

docker-machine ip

docker port {container-name} to find out the exposed ports in a container

To expose a port

docker run -p outside-port:inside-port/{protocol(tcp/udp)}  default its tcp

To limit access of port  we can specify the ip also

docker run -p 127.0.0.1:1234:1234/tcp means if the data is coming from host in 1234 it will accept and redirect  to inside port 1234

Linking containers and Private networks

Two containers can be linked using the command –link {container-name to link to} . This is one way linking. Here the one is linking will have the linked container’s  in its /etc/hosts. This can break if the ip of the linked container change

To avoid breaking, we will use private networks.

docker network create {network-name} create the containers with –net={network-name} that are to be linked

Note

Installation : https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/

Important links:

https://hub.docker.com/

Unfollow all users you follow in Twitter/Cleanup the twitter

Actually I wasn’t using my twitter account for past 4 to 5 months. Suddenly when i opened I got pissed of seeing some random news in some language along with my feed. When i checked my profile, I was subscribed to some 2000 users and groups which i don’t even remember doing.

Now to cleanup this, the only option I see in twitter page was to unfollow each one. Seriously unfollow 2000 users one by one??

Then on google I found some solutions, half of which didn’t work for me. I am adding the one worked for me below here:

  1. Go to the page that show list of users you are following from profile ( profile -> following)
  2. Scroll down  the list till end
  3. press shift+ctrl+i
  4. In console type $(‘.button-text.unfollow-text’).trigger(‘click’)

Note: I did it in batches as my list was more than 2000 and it was throwing error for me.

ReactJs – Experiments for start

ReactJS:

  1. Component Based ( not  MVC – https://medium.com/@dan.shapiro1210/understanding-component-based-architecture-3ff48ec0c238)
  2. Virtual DOM

Used create-react-app for my experiments as a start ( source code for create-react-app : https://github.com/facebookincubator/create-react-app)

sudo npm install -g create-react-app

Create React App doesn’t handle backend logic or databases; it just creates a frontend build pipeline, so you can use it with any backend you want. It uses build tools like Babel ( a compiler ) and webpack (a bundler ) under the hood, but works with zero configuration

Create a new react project:

create-react-app my-app ( This will install react, react-dom, and react-scripts. Difference for react and react dom is explained http://stackoverflow.com/questions/34114350/react-vs-reactdom)

cd my-app ( The folder structure is as below)

s1

npm start (This will start the server at port 3030 and app is available at http://localhost:3000/)

helloworld

Code is available in https://github.com/remyaraj/reactexperiments

 

Working:

  1. In the public folder you will see an index.html which is hit on loading url localhost:3000
  2. In the body of html file there is a div with id “root”.indexhtml
  3. Webpack bundles and keeps a file called index.js in src folder. U can find the below           code in it

ReactDOM.render(
<App />,
document.getElementById(‘root’)
);

The above line instruct to replace the root element with whatever is returned by the render function of  App Class.