Skip to content

Instantly share code, notes, and snippets.

View deadcoder0904's full-sized avatar
:octocat:
Dead

akshay kadam (a2k) deadcoder0904

:octocat:
Dead
View GitHub Profile
@deadcoder0904
deadcoder0904 / virtual_env.txt
Created October 14, 2016 18:41
Install 3rd Party modules in Python( Ubuntu )
There are three ways to install Python libraries:
(1) Use apt-get, aptitude or similar utilities.
(2) Use easy_install or pip (install pip first, its not available by default)
(3) If you download some .tar.gz file, unzip it and then type sudo python setup.py install
Manually messing with paths and moving files around is the first step to headaches later. Do not do it.
For completeness I should mention the portable, isolated way; that is to create your own virtual environment for Python.
(1) Run sudo apt-get install python-virtualenv
@deadcoder0904
deadcoder0904 / nodeschool_modules.js
Last active May 22, 2017 14:04
Download all node school modules in 1 click
var el = $('.workshopper>code');
var str = '';
for(var i = 0 ; i < el.length ; i++){
if(el[i].innerHTML.indexOf('npm install -g') !== -1)
str += 'sudo npm install -g' + el[i].innerHTML.substr(14) + '\n';
};
console.log(str);
@deadcoder0904
deadcoder0904 / elements_innertext.js
Created September 30, 2016 08:24
Select All Elements InnerText Using Pure Javascript
var spans = document.querySelectorAll('element');
obj = [];
for(var i = 0, l = spans.length; i < l; i++){
obj.push(spans[i].textContent || spans[i].innerText);
}
@deadcoder0904
deadcoder0904 / algorithmic_parameters.txt
Created September 18, 2016 18:49
Parameters for Algorithms
PARAMETERS FOR ALGORITHMS
(1) Time Complexity -
Asymptotic Analysis
(2) Space Complexity or Memory Usage -
(a) In Place ( Constant Memory )
@deadcoder0904
deadcoder0904 / classification_of_algorithms
Created September 18, 2016 16:00
Classification of Algorithms
Classification of Algorithms
Contents
Classification by purpose
By implementation
By design paradigm
By complexity
Classification by purpose
@deadcoder0904
deadcoder0904 / sorting_theory.txt
Created September 18, 2016 15:57
Sorting Algorithms Theory
Sorting is a key to CS theory, but easy to forget. I had an itch to review the algorithms in Wikipedia (strange, I know), and here are my notes:
High-level thoughts
Some algorithms (selection, bubble, heapsort) work by moving elements to their final position, one at a time. You sort an array of size N, put 1 item in place, and continue sorting an array of size N – 1 (heapsort is slightly different).
Some algorithms (insertion, quicksort, counting, radix) put items into a temporary position, close(r) to their final position. You rescan, moving items closer to the final position with each iteration.
One technique is to start with a “sorted list” of one element, and merge unsorted items into it, one at a time.
Complexity and running time
Factors: algorithmic complexity, startup costs, additional space requirements, use of recursion (function calls are expensive and eat stack space), worst-case behavior, assumptions about input data, caching, and behavior on already-sorted or nearly-sorted data
Worst-case behav
@deadcoder0904
deadcoder0904 / .zshrc
Last active April 3, 2021 11:39
My Aliases for Oh My Zsh & .zshrc File
# Path to your oh-my-zsh installation.
export ZSH=/home/deadcoder0904/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#ZSH_THEME="agnoster"
#ZSH_THEME="cobalt2"
@deadcoder0904
deadcoder0904 / recursive-circularly-rotated-array.cpp
Created September 9, 2016 07:36
Application of Binary Search - Circularly Rotated Array
#include<bits/stdc++.h>
#define min(x,y) x<y?x:y
using namespace std;
int min_index(int a[],int n){
int low=0,high=n-1;
while(low<=high){
if(a[low]<=a[high])