Skip to content

Instantly share code, notes, and snippets.

View quickgrid's full-sized avatar

Asif Ahmed quickgrid

View GitHub Profile
@quickgrid
quickgrid / Html5-form.markdown
Created September 8, 2013 19:22
A Pen by Asif Ahmed.
@quickgrid
quickgrid / UVA 673 Critical Input.txt
Last active September 29, 2015 09:34
These are some critical inputs for UVA 673 Parentheses Balance Problem. All of them are balanced. Their output should be Yes.
99
[ () ( []()((())() ( [[ ] [ [ [( ([]) ) ] ] [] ] ] ))()) ]
[ () ( []()((())() ( [[ ] [ [ [( ([]) ) ] ] [] ] ] ))()) [] ]
[ () ( []()((())() ( [[ ] [ [ [( ([]) ) ] ] [] ] ] ))()) ]
[ () ( []()((())() ( [[ ] [ [ [( ([]) ) ] ] [] ] ] ))()) ]
[ () ( []()((())() ( [[ ] [ [ [( ([]) ) ] ] [] ] ] ))()) ]
[ () ( []()((())() ( [[ ] [ [ [( ([]) ) ] ] [] ] ] ))()) [] ]
[ () ( []()((())() ( [[ ] [ [ [( ([]) ) ] ] [] ] ] ))()) ]
[ () ( []()((())() ( [[ ] [ [ [( ([]) ) ] ] [] ] ] ))()) [] ]
@quickgrid
quickgrid / uva 417 - word index (worst possible solution).cpp
Created December 11, 2015 15:30
With this code I compete for the worst coder competition.
/**
* Author: Asif Ahmed
* Problem: UVA 417 - word index
* Technique: Very Slow and worst possible solution.
* 5 (five) dimensioanl vector integer array. 1, 2
* 3, 4 (four) dimensional integer array.
*/
#include <vector>
#include <iostream>
@quickgrid
quickgrid / cleanFile.sh
Last active April 1, 2016 03:03
Shell script for deleteing all contents of the file passed in as argument
#!/bin/bash
# Delete all the data in the passed argument file.
echo "" > "$1"
@quickgrid
quickgrid / numberGenerator.sh
Created March 5, 2016 14:27
shell script for generates numbers using for loop and writes to file
#!/bin/bash
# Generate numbers and save / append in the specified file.
generateNumbers(){
for (( c=1; c<=$1; c++ ))
do
echo $c >> numbers.txt
done
}
@quickgrid
quickgrid / factorialMain.sh
Created March 5, 2016 14:31
Shell script for reading from file and passing the data to another script to calculate factorial
#!/bin/bash
# Read from file and send data to another script to calculate.
readAndCalculateData(){
while read input
do
echo "sending $input to Calculate:"
bash factorial.sh $input
done < "$1"
@quickgrid
quickgrid / factorial.sh
Created March 5, 2016 14:32
Shell script for calculateing factorial with either reading user input from terminal or passed in arguments
#!/bin/bash
# Mainly a demonstration of various ways to do the same thing.
# Using passed in argument or read from terminal.
# Factorial calculation by reading data a file by another program
# and use the output from that program as a input of this program.
calculateFactorial(){
#check if any command line arguments were passed otherwise read input.
@quickgrid
quickgrid / cppHtmlParser.txt
Created March 6, 2016 14:49
It show the parent child relation of html tags ( or anything else on space based hierarchy )
/**
* Author: Asif Ahmed
* Site: https://quickgrid.blogspot.com
* Problem: Parse a text file and show details of hierarchial relation between the lines.
* Technique: It show the parent child relation of html tags ( or anything else on space based hierarchy )
*/
#include<iostream>
#include<string>
#include<cstdio>
@quickgrid
quickgrid / forktest.c
Last active April 1, 2016 03:03
This code is to create process in Linux and trace the flow
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<unistd.h>
int main(int argc, char *argv[]){
printf("1.Process PID: %d\n", (int)getpid());
@quickgrid
quickgrid / Even Odd Checker Explanation.asm
Created March 14, 2016 16:38
This 8086 assembly code checks even or odd and prints their output. The code is explained in comments line by line.
;Author:quickgrid
;Site: http://quickgrid.blogspot.com
;Code: Even odd check 8086 assembly code
;predefined macro for speed coding
;define any code here that is reduandant
newline macro