Skip to content

Instantly share code, notes, and snippets.

View sharmaeklavya2's full-sized avatar
📚
Not coding actively anymore. Doing math instead.

Eklavya Sharma sharmaeklavya2

📚
Not coding actively anymore. Doing math instead.
View GitHub Profile
@sharmaeklavya2
sharmaeklavya2 / tictactoe.java
Created July 20, 2018 11:57
Tic Tac Toe in Java
import java.io.*;
import java.lang.*;
class InvalidMoveException extends Exception {}
class InvalidBoardStateException extends RuntimeException {}
class Board {
private int n, n2;
private char[] a;
private static final char pchar[] = {'-', 'X', 'O'};
@sharmaeklavya2
sharmaeklavya2 / speak4me.py
Last active May 12, 2018 08:44
Inverse Dictation (word-by-word, not line-by-line)
#!/usr/bin/env python3
"""
This is an inverse-dictation program.
It speaks out word-by-word (not line-by-line) whatever you type.
"""
import sys
import os
import subprocess
@sharmaeklavya2
sharmaeklavya2 / gsoc-pres.md
Created September 26, 2017 19:15
Presentation on GSoC (compile with jdan/cleaver)
@sharmaeklavya2
sharmaeklavya2 / explanation.md
Last active September 19, 2017 09:02
openai-gym CartPole-v0 hill_climb

Solution to OpenAI Gym CartPole-v0 using hill climbing

Problem statement

https://gym.openai.com/envs/CartPole-v0

A pole is attached by an un-actuated joint to a cart, which moves along a frictionless track. The system is controlled by applying a force of +1 or -1 to the cart. The pendulum starts upright, and the goal is to prevent it from falling over. A reward of +1 is provided for every timestep that the pole remains upright.

@sharmaeklavya2
sharmaeklavya2 / ekunc.c
Last active February 10, 2017 11:12
My netcat clone
#define _POSIX_SOURCE
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<unistd.h>
@sharmaeklavya2
sharmaeklavya2 / covertype.ipynb
Last active December 15, 2021 02:25
Forest Covertype Dataset Analysis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sharmaeklavya2
sharmaeklavya2 / adult.ipynb
Last active August 5, 2017 17:13
US Census Income Dataset Analysis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sharmaeklavya2
sharmaeklavya2 / cpintro.md
Last active February 18, 2020 23:53
Slides used in ACM-CPSIG 2017

Introduction to Competitive Programming

--

Presentation summary

  • What is competitive programming (CP)?
  • Why do CP?
  • How and where to practice?
  • Comparison of programming languages
@sharmaeklavya2
sharmaeklavya2 / cf_750F_judge.py
Created January 2, 2017 12:47
Codeforces problem 750F
#!/usr/bin/env python3
# Pass the path to a hack file as a command-line argument
import sys
from collections import defaultdict
fobj = open(sys.argv[1])
t = int(fobj.readline())
print(t, flush=True)
@sharmaeklavya2
sharmaeklavya2 / clustering.md
Last active October 22, 2016 10:16
Clustering notes

Clustering

Uses of clustering

  • Summarization: Apply algo on cluster prototypes instead of actual data if actual data is large.

  • Compression: Don't store all attributes of all objects. Store all attributes for cluster prototypes.