Skip to content

Instantly share code, notes, and snippets.

View mohitmun's full-sized avatar
💭
yak shaving

Mohit Munjani mohitmun

💭
yak shaving
View GitHub Profile
@mohitmun
mohitmun / brew_21_12_2017
Created December 21, 2017 07:37
Brew packages
adns
gettext
lame
matlab2tikz
sane-backends
adwaita-icon-theme
gflags
leptonica
maven
scapy
Problem: I love AskHN, but they show top 60 posts so chances on losing good questions are high;
Solution: Found hnrss.org, use IFTTT to push updated to telegram. solved
This is too good http://www.brynosaurus.com/pub/net/p2pnat/
@mohitmun
mohitmun / uber_vs_publictransport.rb
Last active January 23, 2018 07:39
Script I used to compare my travel time when using uber vs publictransport (bus, train) Note: This code doesnt include using bus/train data. Used google location history to track public transport timings
require 'json'
token = YOUR_TOKEN
cmd = "curl -H 'Authorization: Bearer #{token}' -H 'Accept-Language: en_US' -H 'Content-Type: application/json' 'https://api.uber.com/v1.2/history?limit=50'"
res = `#{cmd}`
b = JSON.parse(res)
require 'csv'
data = [["Request time", "Start time", "End time", "Distance", "Wait time", "Travel time", "Total time"]]
b["history"].each do |item|
rt = Time.at(item["request_time"])
rts = rt.strftime("%m/%d/%Y %I:%M%p")
@mohitmun
mohitmun / find_by_json_store
Last active February 4, 2018 16:34
find_by equivaltent for json datatype
def self.find_byjs(hash)
User.where("(json_store ->> '#{hash.keys.first}') = ?", hash.values.first).last
end

stderr in red 2> >(while read line; do echo -e "\e[01;31m$line\e[0m" >&2; done)

require 'json'
require 'csv'
def run_command(command)
puts "Running command #{command}"
res = `#{command}`
return res
end
args = {}
ARGV.each do |arg|
@mohitmun
mohitmun / about.md
Created April 29, 2018 10:48 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@mohitmun
mohitmun / 00-about-search-api-examples.md
Created April 29, 2018 10:52 — forked from jasonrudolph/00-about-search-api-examples.md
5 entertaining things you can find with the GitHub Search API
CS
DMKS
Heterogeneous programming
OpenCl
https://en.wikipedia.org/wiki/OpenCL
Compilers
Design patterns
https://en.wikipedia.org/wiki/Worse_is_better
File System
File Descriptors