Skip to content

Instantly share code, notes, and snippets.

View ylogx's full-sized avatar
🤘
<div><ståtús/></div>

Shubham Chaudhary ylogx

🤘
<div><ståtús/></div>
View GitHub Profile
@ylogx
ylogx / decipher.c
Last active December 24, 2015 22:59
P3 - Decypher
/*
* foobar - Shubham Chaudhary
* Nitul Datt
Alice and Bob are being held at Azkaban(Prison). They want to escape and join Dumbledore's Army. Alice wants to tell Bob about the details of the plan but wants to keep their escape plan from Dementors(the guards). So Alice encrypts the message before passing the chits to Bob's cell. However Bob was careless and he disposed the chits in his cell's waste paper bin. The clever Dementor found the chits but couldn't make out what they said. So he hired a computer programmer to decode the message for him. Please help the Dementor to decypher the message.The code key that Alice used for this simple coding is a one for one character substitution based upon a single arithmetic manipulation of the printable portion of the ASCII character set.INPUTThe Encrypted message in a single line. The maximum number of charaters in a message is 100. (DO NOT PRINT ANY PROMPT MESSAGE TO ENTER THE ENCRYPTED MESSAGE.)OUTPUTThe decrypted message in a single line. (Do not print a
@ylogx
ylogx / psmapa.c
Created October 7, 2013 23:20
psmapa.c - Aspiration 2020 Contest Problem
/*
* foobar - Shubham Chaudhary
* Nitul Datt
*/
#include <stdio.h>
#include <stdlib.h>
int fastread()
{
unsigned int input;
@ylogx
ylogx / pymate.c
Last active December 24, 2015 22:59
P2 - Pythagorean Math Test
/*
* foobar - Shubham Chaudhary
* Nitul Datt
Pythagorean Math TestPythagoras is teaching mathematics to a class of N students. He wants to test if his students understood his new theorem. He gives his students the length of the sides of a triangle and they have to tell him if it is a right triangle.InputFirst line an integer N, the number of students. 0<N<=50Next N lines each containing 3 integers a, b and c which are the length of the sides of the triangle. 0<a,b,c. (DO NOT PRINT ANY PROMPT MESSAGE TO READ THE INPUT.)OutputIf the given triangle is right angled print "RIGHT TRIANGLE" in a single line. If the given triangle is not right angled print "NOT RIGHT TRIANGLE" in a single line. (DO NOT PRINT ANY MESSAGE OTHER THAN THE SPECIFIED OUTPUT.)Sample input23 5 43 2 1Sample outputRIGHT TRIANGLENOT RIGHT TRIANGLE
*/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
@ylogx
ylogx / trans.c
Last active December 24, 2015 22:59
P1 - translator
/*
* foobar - Shubham Chaudhary
* Nitul Datt
TranslatorIn a country of Neverland there are two types of programmers, People who program using a language X(X people) and people who program using a language Y(Y people). Both are equally good languages but there is no translator that could translate X language to Y and vice versa.Apologists of X and Y can argue for hours proving each other that their programming language is the best one. Y people will tell that their programs are clearer and less prone to errors, while X people will laugh at their inability to instantiate an array of generics or tell them that their programs are slow and have long source code.Another issue that X and Y people could never agree on is identifier naming. In Y a multiword identifier is constructed in the following manner: the first word is written starting from the small letter, and the following ones are written starting from the capital letter, no separators are used. All other letters are small. Examples of a Y identi
@ylogx
ylogx / base.cpp
Last active December 26, 2015 08:09
base file for online competition
/*
* Team Fork
*/
#include <list>
#include <utility>
#include <functional>
#include<algorithm> //min(), max(), reverse(), sort(), next_permutation(), prev_permutation(), swap()
#include<iostream>
#include<cassert> //assert()
@ylogx
ylogx / Makefile
Last active August 29, 2015 14:14
A makefile to compile all source code in a given folder
#########################################################################
#
# Makefile - This Makefile compiles all c files in given folder
# Copyright (c) 2014-2015 Shubham Chaudhary <me@shubhamchaudhary.in>
#
#########################################################################
#SPECIFIED_SRC_FILE = $(foreach d,$(SPECIFIED_SRC_DIRS),$(wildcard $(addprefix $(d)/*,*.c)))
#CC = gcc
@ylogx
ylogx / build-and-run.sh
Last active March 2, 2020 20:32
Build Script for doing Android Studio 'run' equivalent from command line
#!/usr/bin/env bash
PACKAGE=com.example.demo
ACTIVITY=.MainActivity
APK_LOCATION=app/build/outputs/apk/app-debug.apk
echo "Package: $PACKAGE"
echo "Building the project with tasks: $TASKS"
./gradlew $TASKS
@ylogx
ylogx / build.gradle
Created March 21, 2016 12:02
Fancy Print test results with gradle
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events "passed", "skipped", "failed", "standardOut"
showExceptions true
exceptionFormat "short"
showCauses true
showStackTraces true
package com.peplet.hulkdownloader.app.background.utils;
import android.content.Context;
import android.content.SharedPreferences;
import android.provider.Settings.Secure;
import android.support.annotation.NonNull;
import android.telephony.TelephonyManager;
import java.io.UnsupportedEncodingException;
import java.util.UUID;
@ylogx
ylogx / load_and_cache.py
Created July 21, 2016 12:56
Load a dataset and cache it for further calls
import numpy as np
import pickle
def load_and_cache(filename):
output = None
cache_dir = '/tmp/my_project_cache/'
os.makedirs(cache_dir, mode=0o744, exist_ok=True)
cache = cache_dir + filename + '.pkl'
if not os.path.exists(cache):
output = np.genfromtxt(filename, dtype=float, delimiter=',') # TODO: Fill your logic