Skip to content

Instantly share code, notes, and snippets.

View v-adhithyan's full-sized avatar
🎯
Zen mode

Adhithyan Vijayakumar v-adhithyan

🎯
Zen mode
View GitHub Profile
@v-adhithyan
v-adhithyan / play_rummy.py
Created January 6, 2022 14:32
Simple rummy game developed for my youtube video.
'''
Game rules:
- You can play as many games until you have cash left in account
- In each game you can play 5 turns.
- For each turn winner will be announced.
- If you have the card 25 or 43, you should throw that card to win
- If you win you get 500 Rs.
- If you lose, 500 will be deducted from your account.
'''
import random
@v-adhithyan
v-adhithyan / loksabha.csv
Created February 27, 2019 03:11
India Loksabha constituencies list in JSON and CSV by state and union terittories.
State/Union Territory Constituency Name
Andhra Pradesh Araku
Andhra Pradesh Srikakulam
Andhra Pradesh Vizianagaram
Andhra Pradesh Visakhapatnam
Andhra Pradesh Anakapalli
Andhra Pradesh Kakinada
Andhra Pradesh Amalapuram
Andhra Pradesh Rajahmundry
Andhra Pradesh Narasapuram
@v-adhithyan
v-adhithyan / ReadingTime.kt
Created January 9, 2018 07:25
Reading Time calculation
fun getReadingTime(content: String): String {
val totalWords = content.trim().split(" ").size
// 275 words can be read in a minute.
val wordsPerMinute = 275.toDouble()
val wordsPerSecond = (wordsPerMinute / 60)
val totalReadingTimeSeconds = totalWords / wordsPerSecond
val readingTimeMinutes = Math.round(totalReadingTimeSeconds / 60.toDouble())
@v-adhithyan
v-adhithyan / bw.py
Created September 11, 2016 03:41
Python Open Cv script to convert an image to black and white and save it.
import cv2
import sys
if len(sys.argv) == 1:
print "Pic path should be provided as argument"
sys.exit(0)
# Get input pic name as commad line argument
img_name = sys.argv[1]
public class Peacock {
public Object getUtility(Context context, Utility utility){
switch(utility){
case TOAST:
return ToastUtil.class.cast(new ToastUtil(context));
case ALERT:
return AlertUtil.class.cast(new AlertUtil(context));
default:
@v-adhithyan
v-adhithyan / cf_helper.py
Last active June 23, 2016 06:24
Python script to create a src directory for codeforces round and create 6 java files with a template
import os
import sys
def pretty():
print "***************************************************"
return
base_directory = "/Users/adhithyan-3592/Documents/workspace"
template = """import java.util.Scanner;
@v-adhithyan
v-adhithyan / batteryStats.scpt
Last active April 3, 2016 07:17
An apple script that runs every minute and checks if the mac is running on battery and saves the time spent by mac on battery to a text file.
tell current application
do shell script "pmset -g everything | grep Cycles"
set status to the result
set AC to word 1 of status
if AC contains "No" then
tell application "Finder"
if not (exists file "battery-stats.txt" of desktop) then
make new file at desktop with properties {name:"battery-stats.txt"}