Skip to content

Instantly share code, notes, and snippets.

View rupakraj's full-sized avatar

Rupak Raj Ghimire rupakraj

View GitHub Profile
@rupakraj
rupakraj / django-setup
Created January 25, 2015 08:33
Setup the Django and run upto hello world
Setup the Django and run upto hello world
=========================================
Install python and python-pip
then use the pip to install the python
pip install Django==1.7.3
To check if installed properly (Go to pythong CLI)
@rupakraj
rupakraj / django-setup
Created January 25, 2015 08:34
Setup the Django and run upto hello world
Setup the Django and run upto hello world
=========================================
Install python and python-pip
then use the pip to install the python
pip install Django==1.7.3
To check if installed properly (Go to pythong CLI)
@rupakraj
rupakraj / gist:54488f445c06876642fc
Last active August 29, 2015 14:19
Install Sublime text in Ubuntu
For Sublime-Text-2:
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text
For Sublime-Text-3:
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
@rupakraj
rupakraj / pulseaudio-trouble.txt
Created August 16, 2015 06:21
Linux - Resetting the sound card
Install the pulseaudio in the xubuntu. If pulseaudio is already installed skip the following commad
$sudo apt-get install pulseaudio
Then you can start pulseaudio as follows
$sudo start-pulseaudio-x11 start
The start-pulseaudio-x11 start also works in if you are getting sound on the headphione only.
@rupakraj
rupakraj / PostGreSQL Default Password
Created September 3, 2015 08:24
To change the default password of the the PostGreSQL
To change the default password of the the PostGreSQL Postgres user from command line tool :psql
User: postgres
Tool: Psql
Enter on the command line:
$ sudo -u postgres psql postgres
$\# \password postgres
You'll see:
@rupakraj
rupakraj / PostGreSQl - Installer
Created September 3, 2015 08:29
Intalling the post GreSQL using standard package manger apt-get in ubuntu
Following main and supporting packages are required
postgresql-client-9.4 - client libraries and client binaries
postgresql-9.4 - core database server
postgresql-contrib-9.4 - additional supplied modules
libpq-dev - libraries and headers for C language frontend development
postgresql-server-dev-9.4 - libraries and headers for C language backend development
pgadmin3 - pgAdmin III graphical administration utility
@rupakraj
rupakraj / install_update_ruby
Created November 11, 2015 07:49
Installing and Updating the Ruby on Ubuntu 10.04
First of all, install the prerequisite libraries:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
Then install rbenv, which is used to install Ruby:
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
@rupakraj
rupakraj / Datatable->LINQ
Last active November 26, 2015 07:06
C# System.Data.DataTable ->List<Object>
Using Select(): a power of LINQ for casting datatable into List of Object
List<Student> target = dt.AsEnumerable()
.Select(row => new Student
{
// assuming column 0's type is Nullable<long>
StudentID = row.Field<long?>(0).GetValueOrDefault(),
StudentName = String.IsNullOrEmpty(row.Field<string>(1)),
}).ToList();
@rupakraj
rupakraj / notify.js
Created January 24, 2016 08:18
Use node-gcm using npm
var gcm = require('node-gcm');
var notify = exports;
notify.send = function(msg, reg_id) {
var message = new gcm.Message();
message.addData('msg', msg);
// get token here
// TODO
//var regTokens = ['APA91bFiJx52Iq2_LwyXPUWeO0Vg-9DmrWW6E6BmjwNUtTIrWRNOIDzaCmOidzndjZE3zWvL248GtqBYIV7YsD9q37M0urFz3FD6DvYkOaVqJqV3V9CciPletqzbJqvEm-54cpwMNcxP'];
@rupakraj
rupakraj / django-db-reset
Created February 2, 2016 16:13
Django migration reset
WARNING: its hard reset, means all the data or log will be removed
To reset the django migration to initial follow following order
* Remove database
* Remove all the contents of django app's migrations folder except __init__.py file.
* The remaining migrations folder should be something like
myapp
├── migrations
│   │   ├── __init__.py