Skip to content

Instantly share code, notes, and snippets.

View vishnun's full-sized avatar

Vishnu Narang vishnun

View GitHub Profile
@vishnun
vishnun / save_file.js
Last active October 4, 2017 18:53
Javascript save file
// ************** If you don't have server side, to download data, we can use this. **************
function download(data, filename, type) {
var file = new Blob([data], {type: type});
if (window.navigator.msSaveOrOpenBlob) // IE10+
window.navigator.msSaveOrOpenBlob(file, filename);
else { // Others
var a = document.createElement("a"),
url = URL.createObjectURL(file);
a.href = url;
a.download = filename;
@vishnun
vishnun / postgres-install-ubuntu.md
Created May 16, 2017 02:15
Postgresql installation for ubuntu

Step 1: Add PostgreSQL Apt Repository

PostgreSQL packages are also available in default Ubuntu repository, But when I try to install PostgreSQL on Ubuntu 12.04 I only found PostgreSQL 9.1 was in default apt repository. So I request you to add PostgreSQL apt repository first in your system suggested on official PostgreSQL website using following command.

$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
$ wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

Step 2: Install PostgreSQL

@vishnun
vishnun / index.html
Last active May 10, 2017 23:59
index.html for the captivate project that needs to communicate with flash file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name='viewport' content='initial-scale = 1, minimum-scale = 1, maximum-scale = 1' />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=10">
<title></title>
<style type="text/css">
#initialLoading {
@vishnun
vishnun / flash-js-communication.html
Last active May 10, 2017 18:39
Way to communicate from flash to captivate using js.
<!-- Copyright [2008] Adobe Systems Incorporated. All rights reserved -->
<!-- saved from url=(0013)about:internet -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>

Untar

tar -xzf RubyMine-2017.1.2.tar.gz

Make directory for source and executable

mkdir -p ~/bin/rubymines/ mkdir -p ~/bin/rubymine/

Move rubymine source to rubymines

mv RubyMine-2017.1.2 ~/bin/rubymines

@vishnun
vishnun / docker-cheat-sheet.md
Created April 22, 2017 06:04
docker commands

Remove exited containers:

sudo docker rm $(docker ps -a -q -f status=exited)

List all docker containers

sudo docker ps -a

Run docker container in interactive mode (execute shell of the container busybox for eg):

docker run -it busybox sh

Execute a single command for a container (busybox)

@vishnun
vishnun / django install instructions.md
Created February 17, 2017 00:09
Installing django on mac
@vishnun
vishnun / useful_regex.md
Created February 1, 2017 17:46
A list of useful regex I've used and come across.
  1. Given a line of comma separated words, you want to select those words excluding the comma and put " ' " marks around it. ([^, ]\w*[^,]) # this will select such words.
@vishnun
vishnun / interviewitems.MD
Created December 10, 2016 16:13 — forked from KWMalik/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@vishnun
vishnun / ubuntu-server-django-guide.rst
Created November 26, 2016 05:48 — forked from epicserve/ubuntu-server-django-guide.rst
Ubuntu Server Setup Guide for Django Websites