Skip to content

Instantly share code, notes, and snippets.

View devpruthvi's full-sized avatar
🎯
Focusing

Pruthvi Raj devpruthvi

🎯
Focusing
View GitHub Profile
@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 / 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 / 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'
#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;
#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(){
@devpruthvi
devpruthvi / MFT.c
Created November 18, 2015 18:30
MFT Operating Systems program in C
#include<stdio.h>
int mm, frs, p[15], fre1, fre2, fr, i = -1, fre;
int main()
{
char ch;
void insert();
void del();
void display();
@devpruthvi
devpruthvi / Bankers.c
Created November 19, 2015 02:22
Banker's Algorithm for deadlock avoidance in C
#include "stdafx.h"
#include<stdio.h>
#include<conio.h>
#define true 1
#define false 0
int available[10], allocation[10][10], max[10][10], need[10][10], work[10], finish[10], maxres[10], safe[10], req[10], m, n;
int find()
{
int i, j;
from mutagen.mp3 import MP3
import subprocess,math
filepath = 'H:/Music/temp/'
filename = 'notafraid.mp3'
a = MP3(filepath + filename)
parts = int(math.ceil(a.info.length / 60))
for each in range(0,parts):
command = 'ffmpeg -ss {} -i {} -c copy -t {} {}{}'.format(each*60,filepath+filename,60,each,filename)
subprocess.call(command,shell=True)
/*
* Social Buttons for Bootstrap
*
* Copyright 2013-2015 Panayiotis Lipiridis
* Licensed under the MIT License
*
* https://github.com/lipis/bootstrap-social
*/
.btn-social{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.btn-social>:first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,0.2)}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sample Breakout Game</title>
<style type="text/css" media="screen">
*
{
padding: 0;
margin: 0;