Skip to content

Instantly share code, notes, and snippets.

View Shekharrajak's full-sized avatar
📚
Being Geek!

Shekhar Prasad Rajak Shekharrajak

📚
Being Geek!
View GitHub Profile
@bpgergo
bpgergo / matrix.py
Created November 28, 2011 11:54
Concurrent matrix multiplication
import random
import multiprocessing
from itertools import starmap, izip, repeat, imap
from operator import mul
def calc_row_of_product_matrix(a_row, b, izip=izip):
'''Calculate a row of the product matrix P = A * B
Arguments:
a_row is af A
b is the B matrix
@markbates
markbates / gist:4240848
Created December 8, 2012 16:06
Getting Started with Rack

If you're writing web applications with Ruby there comes a time when you might need something a lot simpler, or even faster, than Ruby on Rails or the Sinatra micro-framework. Enter Rack.

Rack describes itself as follows:

Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks.

Before Rack came along Ruby web frameworks all implemented their own interfaces, which made it incredibly difficult to write web servers for them, or to share code between two different frameworks. Now almost all Ruby web frameworks implement Rack, including Rails and Sinatra, meaning that these applications can now behave in a similar fashion to one another.

At it's core Rack provides a great set of tools to allow you to build the most simple web application or interface you can. Rack applications can be written in a single line of code. But we're getting ahead of ourselves a bit.

@vishaltelangre
vishaltelangre / pg_gem_installation_error_and_solution.txt
Last active March 16, 2024 01:50
pg (postgresql) gem installation error and solution [ubuntu 12.04]
ERROR
=======
$ gem install pg -v '0.17.0'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/vishal/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for pg_config... yes
@mycodeschool
mycodeschool / DoublyLinkedList.c
Created November 12, 2013 11:38
Doubly Linked List implementation in C
/* Doubly Linked List implementation */
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node* next;
struct Node* prev;
};
@mycodeschool
mycodeschool / Queue_LinkedList.c
Last active December 2, 2023 11:22
Linked List implementation of Queue.
/*Queue - Linked List implementation*/
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node* next;
};
// Two glboal variables to store address of front and rear nodes.
struct Node* front = NULL;
struct Node* rear = NULL;
/* Deleting a node from Binary search tree */
#include<iostream>
using namespace std;
struct Node {
int data;
struct Node *left;
struct Node *right;
};
//Function to find minimum in a tree.
Node* FindMin(Node* root)
#include<iostream>
#include<cstdlib>
#include<set>
using namespace std;
struct Node {
int data;
struct Node *next;
};
int length(struct Node *head) {
@ivycheung1208
ivycheung1208 / graph.h.cpp
Created July 12, 2014 05:36
DFS and BFS in directed graph
/* Implement a directed graph using adjacency list representation
* Depth First Traversal for a Graph: http://www.geeksforgeeks.org/depth-first-traversal-for-a-graph/
* Breadth First Traversal for a Graph http://www.geeksforgeeks.org/breadth-first-traversal-for-a-graph/
* Connectivity in a directed graph: http://www.geeksforgeeks.org/connectivity-in-a-directed-graph/
*/
#ifndef GRAPH_H
#define GRAPH_H
#include <iostream>
@Shekharrajak
Shekharrajak / hermite.py
Created October 24, 2015 07:24 — forked from cheery/first_fundamental_form.py
Sympy funnies & Cubic hermite
from sympy import *
# https://www.rose-hulman.edu/~finn/CCLI/Notes/day09.pdf
a0, a1, a2, a3, t = symbols('a0 a1 a2 a3 t')
polynomial = a0 + a1*t + a2*t**2 + a3*t**3
polynomial_d = diff(polynomial, t)
p0, v0, p1, v1 = symbols('p0 v0 p1 v1')