Skip to content

Instantly share code, notes, and snippets.

View neeraj9's full-sized avatar
🎯
Focusing

Neeraj neeraj9

🎯
Focusing
  • Microsoft
View GitHub Profile
@neeraj9
neeraj9 / basic_application_logging.c
Created March 29, 2018 12:40
Demonstrate Application Logging in C Programming Language
/*
* Copyright (c) 2015 Neeraj Sharma. All rights reserved.
*
* Licensed under GNU GPL v3 License.
* License: https://www.gnu.org/licenses/gpl-3.0.txt
*
* Code style based on the Linux Kernel, see
* https://www.kernel.org/doc/Documentation/CodingStyle
* for more details.
*
@neeraj9
neeraj9 / bandwidth_monitoring.c
Created March 29, 2018 12:57
Simple Bandwidth monitoring in Gnu Linux
/*
* Copyright (c) 2015 Neeraj Sharma. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@neeraj9
neeraj9 / building_microsoft_graphengine_from_source.sh
Created April 23, 2018 01:56
Build Microsoft GraphEngine from source on Ubuntu 16.04
# Author: Neeraj Sharma
#
# https://www.graphengine.io/docs/manual/index.html
# https://www.microsoft.com/net/learn/get-started/linux/ubuntu16-04
setup_dot_net() {
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
@neeraj9
neeraj9 / py_beamparticle_testing_runeditor
Created May 5, 2018 03:02
BeamParticle sample python program which is to be used for evaluation via runeditor
#!python
from pymongo import MongoClient
import pandas as pd
from datetime import datetime
from datetime import timedelta
import requests
import sys
import json
@neeraj9
neeraj9 / web_retrieve_url_and_summarize.erl.fun
Last active February 9, 2019 21:08
BeamParticle retrieve website and extract readable text
#!erlang
%% @doc Fetch content from internet and summarize
%% @author Neeraj Sharma
%%
%% run web_retrieve_url_and_summarize(<<"http://beamparticle.org/about.html">>, 5000, 5000)
%%
fun(Url, ConnectTimeoutMsec, TimeoutMsec) when (is_binary(Url) orelse is_list(Url))
andalso is_integer(ConnectTimeoutMsec)
andalso is_integer(TimeoutMsec) ->
Headers = [],
@neeraj9
neeraj9 / py_text_readability.py.fun
Created March 29, 2018 10:01
BeamParticle clean up data received from website
#!python
#
# py_text_readability
#
# see https://github.com/buriy/python-readability#python-readability
#
# Dependencies:
#
# sudo pip3 install readability-lxml
#
@neeraj9
neeraj9 / beamparticle_http_post_json.py
Last active February 9, 2019 22:26
BeamParticle Python 3 Dynamic function for /post/ HTTP POST JSON handler
#!python
# Sample Python 3 function to return what was passed in as the first argument.
# Notice that this template works for the /post/<thisfun> interface, where
# json input is passed in the first argument postBody, while the response
# is a binary or a string, which must be json as well.
from Pyrlang import term
import json
def main(data_binary, context_binary):
@neeraj9
neeraj9 / beamparticle_http_post_json.ex
Last active February 9, 2019 22:27
BeamParticle Elixir Dynamic function for /post/ HTTP POST JSON handler
#!elixir
# Sample Python 3 function to return what was passed in as the first argument.
# Notice that this template works for the /post/<thisfun> interface, where
# json input is passed in the first argument postBody, while the response
# is a binary or a string, which must be json as well.
fn (body, context) ->
decoded_map = :jiffy.decode(body, [:return_maps])
# TODO process decoded_map
result = decoded_map
@neeraj9
neeraj9 / beamparticle_http_post_json.efe
Created February 6, 2018 02:46
BeamParticle Efene Dynamic function for /post/ HTTP POST JSON handler
#!efene
#_ "A sample efene code to return what was passed in as the first argument."
#_ "Notice that this template works for the /post/<thisfun> interface, where"
#_ "json input is passed in the first argument postBody, while the response"
#_ "is a binary or a string, which must be json as well."
#_ ""
#_ "Read about Efene at efene.org"
#_ "see http://efene.org/language-introduction.html"
#_ ""
#_ "Author: Neeraj Sharma <neeraj.sharma@alumni.iitg.ernet.in>"
@neeraj9
neeraj9 / beamparticle_http_post_json.erl
Last active February 9, 2019 22:28
BeamParticle Erlang Dynamic function for /post/ HTTP POST JSON handler
#!erlang
%% Sample Erlang (OTP-20) function to return what was passed in as the first argument.
%% Notice that this template works for the /post/<thisfun> interface, where
%% json input is passed in the first argument postBody, while the response
%% is a binary or a string, which must be json as well.
fun (Body, Context) ->
DecodedMap = jiffy:decode(Body, [return_maps]),
%% TODO process decoded_map
Result = DecodedMap,