Skip to content

Instantly share code, notes, and snippets.

Being Geek!

Shekhar Prasad Rajak Shekharrajak

Being Geek!
View GitHub Profile
View One Liner to Download the Latest Release from Github
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
View gist:0ab56c74c16ca6e49cfeedc20fee0624

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.

import csv
import cStringIO
import codecs
import glob
import json
import requests
def fetch_jsons():
url = (''
Shekharrajak /
Created Apr 3, 2016 — forked from bpgergo/
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
a_row is af A
b is the B matrix
Shekharrajak /
Created Nov 5, 2015 — forked from richardotis/
Integrating SymPy with autograd for efficient automatic differentiation of lambdify'd functions
This module manages interactions with the autograd library.
import autograd.numpy as anp
import numpy as np
from autograd import elementwise_grad, jacobian
from sympy import lambdify
# NumPyPrinter requires unreleased sympy 0.7.7 (in sympy master)
# if you aren't using Piecewise or logical operators
# you can change NumPyPrinter to LambdaPrinter in this module
Shekharrajak /
Created Oct 24, 2015 — forked from cheery/
Sympy funnies & Cubic hermite
from sympy import *
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')
View 1SheeldVoiceTwitFacePoster
//Not all this code is my code. This code is part of code. It is part of their simple example-Voice Recognizer
/* if you post to much to facebook ant twitter in a short amout of time you wil not be able to post anything for a while*/
/*Keep by 140 characters when using Twitter otherwize it will not tweet*/
/* Include 1Sheeld library. */
#include <OneSheeld.h>
/* Voice commands set by the user. */
//Voice commands the 1sheeld is going to react to -- Set by the user--
const char tweetCommand[] = "tweet"; //Change the word in the brackets to your preffered word
const char facebookpostCommand[] = "post on facebook"; //DO NOT USE CAPITALS