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 / phrase_anagram_checker.py
Created June 13, 2019 18:54
phrase anagram checker
#!/usr/bin/env python3
"""Takes multiple lines as input and checks if they are anagrams."""
import re
import hashlib
import argparse
def normalize(s):

JavaScript object hierarchy

This document aims to explain what various attributes like constructor, prototype and __proto__ point to and what happens when new objects are created.

There are several ways of creating new objects:

  • o = {'one': 1, 'two': 2};
  • function f() {return 'three';}
@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)

author: name: Eklavya Sharma email: [email protected] title: GSoC output: gsoc-pres.html


GSoC 2017

@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 October 22, 2024 18:07
Forest Covertype Dataset Analysis
Loading
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
Loading
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