Skip to content

Instantly share code, notes, and snippets.

Being Geek!

Shekhar Prasad Rajak Shekharrajak

Being Geek!
View GitHub Profile
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
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 \" \
Shekharrajak /
Created Mar 26, 2019
sympy.integrals.rubi test

In [2]: rubi_integrate(x**2 + x + 1, x)                                                                                                                                                                       
x        ⌠     
── + x + ⎮ x dx
3        ⌡     

In [3]: rubi_integrate(x/(x**2+2*x+1), x)                                                                                                                                                                     
View daru_benchmark.rb
require_relative 'benchmarker'
$:.unshift File.expand_path("../../../lib", __FILE__)
DF_SIZE_POW_10 = [2, 3, 4, 5, 6, 7]
DF_SIZE_POW_10.each do |df_size|
puts "DataFrame of size : #{10**df_size} "
View daru_benchmarker.rb
require 'benchmark'
$:.unshift File.expand_path("../../../lib", __FILE__)
require 'daru'
class Benchmarker
@df =
@df_size = 0
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.

View createFileNodeServer.js
app.get('/createFile', (req, res) => {
var fs = require("fs");
var writeStream = fs.createWriteStream("./data/dynamic_file.txt");
writeStream.write("Hi, Users. I am generated after the /createFile get request. ");
writeStream.write("Thank You.");
res.send('File is generated. Click <a href="/resources/dynamic_file.txt"> here </a> to see the file. Save/download the file using ctrl+s');
View serverStaticFile.js
app.use('/resources', express.static(path.join(__dirname, './data')));
View nodeServer.js
var express = require('express');
var app = express();
var port = process.env.PORT || 1729;
app.listen(port, function () {
console.log('Server has started at port ' + port + ' !!');

Shortcut Keys Function


Escape key Gets out of the current mode into the “command mode”. All keys are bound of commands.

  • i “Insert mode” for inserting text. Keys behave as expected.
  • : “Last-line mode” where Vim expects you to enter a command such as to save the document.

Navigation keys