Skip to content

Instantly share code, notes, and snippets.

View quickgrid's full-sized avatar

Asif Ahmed quickgrid

View GitHub Profile
@quickgrid
quickgrid / Even Odd Checker Loop Label Explanation.asm
Last active April 1, 2016 03:02
Check 8086 assembly even odd in loop.
;Author:quickgrid
;Site: http://quickgrid.blogspot.com
;Code: Even odd check using loop in 8086 assembly explained code
.model small
.stack 100h
.data
@quickgrid
quickgrid / 8086 asm diamond print using user input.asm
Created March 14, 2016 17:28
Prints diamond on console taking user input. Don't input 0 or 1 otherwise fix code yourself.
;Author:quickgrid
;Site: http://quickgrid.blogspot.com
;Code: 8086 assembly diamond print dual loop explained code
org 100h
.stack 100h
.data
@quickgrid
quickgrid / activity_main.xml
Created March 24, 2016 09:33
It is a layout file example showing implementation of multple scroll views.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
@quickgrid
quickgrid / FaxNumbers.txt
Created April 1, 2016 03:05
Sample Fax Numbers for testing various bash codes
+(country code)-(area code)-(fax number)
+1-212-9876543
+44-208-1234567
+443-208434-12345674
+233-11-114567
+190-209-1234567
+1-212-9876543
+44-208-1234567
+443-208434-12345674
+233-11-114567
@quickgrid
quickgrid / EvenLinePrinter.sh
Created April 1, 2016 03:09
Reads the input file line by line in while loop then checks if the number is even or odd using if condition and finally prints even lines.
#!/bin/bash
i=1
while read line
do
var=$(( $i % 2 ))
if [ $var -eq 0 ]; then
echo "$line"
fi
@quickgrid
quickgrid / SpecificLinesEmailGrepRegex.sh
Created April 1, 2016 03:22
The code below gets lines 5 to 10 from input file and perform the given email address regular expression and show the exact match output on console.
#!/bin/bash
head -10 "EmailAddress.txt" | tail -6 | grep --color -E -w "^[A-Za-z0-9._]+@[A-Za-z0-9.]+\.[A-Za-z]{2,6}"
@quickgrid
quickgrid / GrepRegexExactEmailMatch.sh
Created April 1, 2016 03:31
Bash GREP regex match exact email addresses and show in terminal with color highlight.
#!/bin/bash
grep --color -E -w "^[A-Za-z0-9._]+@[A-Za-z0-9.]+\.[A-Za-z]{2,6}" "EmailAddress.txt"
@quickgrid
quickgrid / TimeIntervalRegex.sh
Created April 1, 2016 03:49
The code below uses regex to read line by line and store the data read in three separate variables. The regular expression print data only for matching time within 8:00 to 10:00
#!/bin/bash
c=0
grep -E -w "8:[0-5][0-9]|9:[0-5][0-9]|10:00?" log.txt | while read ip time city ; do
echo "Logged in at $time with ip $ip and city $city "
c=$(( $c + 1 ))
echo "Found so far: $c"
@quickgrid
quickgrid / log.txt
Created April 1, 2016 03:52
Just a bunch of ip address, time and city data to perform time interval regular expression.
192.1.4.09 10:30 Arsenal
110.13.5.67 5:12 Chelsea
192.1.45.67 23:21 Man United
199.13.8.23 8:33 Man city
172.11.22.2 18:45 Arsenal
133.13.8.23 10:00 Moon colony
112.11.22.2 8:00 Mars colony
103.13.8.23 9:00 Jupiter colony
12.11.22.2 8:59 Europa colony
@quickgrid
quickgrid / FileCheckPermissionRemove.sh
Created April 1, 2016 04:03
The code below checks if the given command line argument is a regular file. If it is then it checks if the file is executable. Finally if the file is executable the code removes the execution permission for the owner.
#!/bin/bash
removeExecutablePermission(){
if [ -f $1 ]; then
#echo "regular file"
if [ -x $1 ]; then
#echo "remove permission"