Skip to content

Instantly share code, notes, and snippets.

View coder3101's full-sized avatar
😇
Grateful for all things

Ashar coder3101

😇
Grateful for all things
View GitHub Profile
@coder3101
coder3101 / Gradient Descent.ipynb
Last active January 23, 2020 11:20
Gradient Descent Algorithm in numpy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@coder3101
coder3101 / Mnist.ipynb
Created March 20, 2018 21:59
MNIST Model using TensorFlow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@coder3101
coder3101 / rpc-server.c
Created December 20, 2018 13:50
This is a simple Remote Procedural Calling (RPC) Server. When Executed it listens for client and computes the factorial of the number requested by the client. For Client Code See rpc-client.c gist
#include <unistd.h>
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <string.h>
#define PORT 12345 //Our Server will listen on this port
@coder3101
coder3101 / rpc-client.c
Created December 20, 2018 13:58
This code connects a client to the rpc-server. You need to specify the open interface of the server. It's IP in the IP_ADDR_SERVER macro. See rpc-server.c for furthur information.
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <string.h>
#define PORT 12345
#define IP_ADDR_SERVER "192.168.43.51" //YOU MAY NEED TO CHANGE THIS ADDRESS
int main(){
struct sockaddr_in address;
@coder3101
coder3101 / ExpressionOptimization.md
Created April 15, 2019 19:11
This is a Sample Idea for optimising the mathematical expressions via gist in expression templates.

Optimising an Expression using Strings

This idea assumes that we already have expression templates implemented via Boost.YAP.

Example

Let's assume user writes following snippets of code using our expression template BLAS library :

Tensor a = {{1,1}, {1,1}, {1,1}};
@coder3101
coder3101 / letter.cc
Created May 2, 2019 11:07
A Love Letter in C++
#include <iostream>
#define Its int
#define most main
#define readable (
#define And )
#define deep {
#define cplusplus i
#define code =0
#define Why for
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <syslog.h>
#include <string.h>
#include <sys/inotify.h>
@coder3101
coder3101 / YAP_impl.hpp
Created June 6, 2019 15:54
Sample impl of YAP
#include <boost/yap/expression.hpp>
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
// TAKEN FROM BOOST.YAP EXAMPLES, BUT MODIFIED BY CODER3101
/*
@coder3101
coder3101 / optimization.cc
Created July 24, 2019 12:36
Distributive optimization at tensor-level
struct apply_distributive_law {
constexpr apply_distributive_law() = default;
template <class Expr1, class Expr2>
constexpr decltype(auto)
operator()(boost::yap::expr_tag<boost::yap::expr_kind::plus>, Expr1 &&e1,
Expr2 &&e2) {
// We check if the left and right operands of + is a multiply expression.
// This returns true if expression is of form of multiply of ublas operands.
#include <algorithm>
#include <iostream>
#include <type_traits>
#include <vector>
template <class T>
class LinkedList {
private:
struct Node {
Node(T v) : val(v) {