Skip to content

Instantly share code, notes, and snippets.

View aryan-gupta's full-sized avatar
👾
what even is computational entropy?

Aryan Gupta aryan-gupta

👾
what even is computational entropy?
View GitHub Profile
@aryan-gupta
aryan-gupta / LSTM (unscaled features).ipynb
Created December 17, 2022 02:36
Gaming Desktop Energy Usage Predictor
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aryan-gupta
aryan-gupta / gradient_ascent_test.ipynb
Last active February 28, 2021 15:26
gradient_ascent_test.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aryan-gupta
aryan-gupta / linkedin_challenge.cpp
Created February 22, 2021 03:10
LinkedIn Challenge I got messaged
/*
Can you solve this ?
You are given a deck containing N cards. While holding the deck facedown:
1. Deal all the cards facedown onto a table into Y piles like you would if you were playing with a group of people (i.e. card 1 to P1, card 2 to P2, ..., card Y to PY, card Y + 1 to P1, etc).
2. Combine all the piles into a deck by placing P1 onto P2, then P1+P2 onto P3, and so on. This is a round.
3. Pick up the deck from the table and repeat steps 1-2 until the deck is in the original order.
4. For each round, vary the pile count according to a repeating pattern. Start with 3 piles, then 4, then 5, then loop back to 3, then 4 and so on.
Write a program to determine how many rounds it will take to put a deck back into the original order. This will involve creating a data structure to represent the order of the cards. Do not use an array. This program should be written in C only. It should take a number of cards in the deck as a command line argument and write the result to stdout. Please ensure the program com
@aryan-gupta
aryan-gupta / Dockerfile
Created December 18, 2020 03:58
Failed attempt at Docker VPN Client/RDP container
FROM ubuntu:20.04
RUN apt-get update
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y kmod remmina libgtk2.0-0 libwebkit2gtk-4.0-37
RUN dpkg-reconfigure --frontend noninteractive tzdata
RUN mkdir -p /usr
COPY anyconnect-linux64-4_9_01095-core-vpn-webdeploy-k9.sh /install-vpn.sh
COPY run.sh /run.sh
import base64
import sys
import json
s = base64.b64decode(sys.argv[1])
j = json.loads(s)
file = open('test.txt', 'w')
file.write(str(j))
@aryan-gupta
aryan-gupta / server.py
Last active October 3, 2019 01:21
Slackbot server for Mosaic
#!/bin/env python
import os
from slackeventsapi import SlackEventAdapter
from slack import WebClient
import string
from collections import OrderedDict
import unicodedata
import json
import re
@aryan-gupta
aryan-gupta / Makefile
Created September 17, 2018 01:37
generic-cpp-makefile
#
# Copyright (c) 2018 The Gupta Empire - All Rights Reserved
# Please refer to LICENCE.md in the project root directory for
# licence information. If no Licence file is provided, please
# contact Aryan Gupta <me@theguptaempire.net> for more info
#
#===============================================================================
# @author Aryan Gupta <me@theguptaempire.net>
# @title Makefile
# @brief This is a generic Makefile I use for my C++ projects
#include <iostream>
using namespace std;
using ENUM_TYPE = int;
/// LEGEND:
///
/// for( range_declaration : range_expression )
///
/// translates to:
@aryan-gupta
aryan-gupta / c++_any_impl.cpp
Last active January 10, 2018 16:27
A simple C++ implementation of std::any and tests.
// A lot of this implementation was used from
// http://www.two-sdg.demon.co.uk/curbralan/papers/ValuedConversions.pdf
// This is a good read if you want to better
// understand what's going on here
// Please see ari::any in my libari repo for an updated version
// including small item optimization and fixed decay error
// LINK: https://github.com/aryan-gupta/libari/blob/master/include/any.hpp
@aryan-gupta
aryan-gupta / python_loop_in_c++.cpp
Last active January 5, 2018 00:11
Python ranged based for loop using C++17
#include <array>
#include <iostream>
// This function is th heart of the range loop. Returns
// an array that is allocated on the stack. Because this
// is a constexpr, this array of incrementing numbers is
// calculated at compile time. Please note that if negative
// numbers needs to be used, change \tparam T to a signed
// integer