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
  • 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 https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@Shekharrajak
Shekharrajak / rubi_testing_manual.md
Created March 26, 2019 07:44
sympy.integrals.rubi test

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

In [3]: rubi_integrate(x/(x**2+2*x+1), x)                                                                                                                                                                     
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} "
Benchmarker.benchmark_create_df(10**df_size)
require 'benchmark'
$:.unshift File.expand_path("../../../lib", __FILE__)
require 'daru'
class Benchmarker
@df = Daru::DataFrame.new()
@df_size = 0
@Shekharrajak
Shekharrajak / gist:0ab56c74c16ca6e49cfeedc20fee0624
Created October 17, 2018 13:22 — forked from markbates/gist:4240848
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.

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.");
writeStream.end();
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');
});
app.use('/resources', express.static(path.join(__dirname, './data')));
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

Main

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

Data Analysis and Visualisation in Ruby with daru

In this talk we will be learning about Ruby gem daru (Data Analysis in RUby); a library for storage, analysis, manipulation and visualisation of data. We will learn about simple and fast techniques to import & analyse data sets, exporting data and plotting charts for gaining quick insights into your data, using daru dataframe. Also we will see how daru gem is useful in Ruby framework web applications (e.g. Rails/Sinatra/Nanoc) to directly analyse/manipulate data and display interactive charts to visualise the informations, which helps users to understand it better.

Outlines

  • Introducing myself
  • What is daru ?
  • Why to use daru and what makes it powerful gem for data analysis and visualisation ?