Skip to content

Instantly share code, notes, and snippets.

View devpruthvi's full-sized avatar
🎯
Focusing

Pruthvi Raj devpruthvi

🎯
Focusing
View GitHub Profile
#include<stdio.h>
#include<string.h>
int checkState(char ele[20][20],char array[50][3],int arrlength){
int i;
for(i=0;i<arrlength;i++)
if(strcmp(ele[0],array[i]) ==0)
return i;
return -1;
}
void main(){
#include<stdio.h>
#include<string.h>
void main() {
char input[100],l[50],r[50],temp[10],tempprod[20],productions[25][50];
int i=0,j=0,flag=0,consumed=0;
printf("Enter the productions: ");
scanf("%1s->%s",l,r);
while(sscanf(r+consumed,"%[^|]s",temp) == 1 && consumed <= strlen(r)) {
if(temp[0] == l[0]) {
flag = 1;
@devpruthvi
devpruthvi / alphacoders.py
Created November 1, 2015 15:16
A python script to download all images returned by a search from wall.alphacoders.com , reworked :)
### A program to download wallpapers from alphacoders.com
###Author: N.V.Pruthvi Raj, Anantapur, India.
###Date: 23/12/2014
###Modified on 1/11/2015 according to the new thumbnail system by the site
import requests,urllib2
import shutil
import re
import os
from bs4 import BeautifulSoup
url = 'http://wall.alphacoders.com/search.php?search=digital+art&name=Naruto&page=1'
@devpruthvi
devpruthvi / leftrecursion.c
Created October 31, 2015 14:15
A program to remove left recursion in C with sscanf
#include<stdio.h>
#include<string.h>
void main() {
char input[100],l[50],r[50],temp[10],tempprod[20],productions[25][50];
int i=0,j=0,flag=0,consumed=0;
printf("Enter the productions: ");
scanf("%1s->%s",l,r);
printf("%s",r);
while(sscanf(r+consumed,"%[^|]s",temp) == 1 && consumed <= strlen(r)) {
if(temp[0] == l[0]) {
@devpruthvi
devpruthvi / nestedReplace.java
Created October 23, 2015 06:27
A program for replacing nested "[yes]" patterns
public class Main {
public static String nestedReplace(String s) {
int nested =0,i=0;
StringBuilder o = new StringBuilder();
while(i<s.length())
{
if(nested==0 && s.regionMatches(i,"[yes]",0,4))
{
o.append("Yes");
@devpruthvi
devpruthvi / attendance_automate.py
Last active May 27, 2016 08:47
Attendance Automation for college final
import openpyxl,datetime,os,time,string
from win32com.client import Dispatch
workbookname = raw_input('Enter the workbook name: ')
outputsheetname = workbookname
workbook = openpyxl.load_workbook(workbookname)
allsheets = workbook.get_sheet_names()
print(allsheets)
weeklysheetname = [x for x in allsheets if 'WEEKLY' in x]
for sheetname in allsheets:
if not sheetname.startswith('I'):
done dona done done
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char* lhs[10] = { "E","E","E","E","E" };
char *rhs[10] = { "E+E","E-E","E*E","E/E","a" };
int numProductions = 5;
int row_id,len;
char stack[50] = "$";
char inp_string[50];
int get_id(char * string, char* arr[10],int len)
import ast
allData = []
with open('moosebook.txt','r') as f:
allData = list(map(list,ast.literal_eval('[' + f.read().replace(')(','),(')+ ']' )))
for data in allData:
print(data[0]+' : '+data[5])
$(function () {
function Player(name,marker,score) {
this.name = name;
this.marker = marker;
this.score = score;
};
var p1 = new Player("Player 1","x","000000000");
var p2 = new Player("Player 2","o","000000000");
var SIZE = 3,moves = 0;
var turn = p1;