My Tech Blog
My Tech Blog :) :)

May
04

Everyone using a GNU/Linux OS must be knowing the power of root . Root is the “GOD” for a linux system . He can crash the system with less than 10 keystrokes :) . To be more precise a “rm -rf /” is actually is just 9 keystrokes :)

This tshirt explains the powers of the root clearly.

It is a fact that no normal user can deny any permission to the root. But is it possible to deny the file modification permissions for root by the root himself ???. Hmmm the answer is YES.

A command called chattr can be used to change the file attributes of a file on a Linux second extended file system.

[root@spider lavanya]# chattr +i let.txt

where let.txt is the file to be protected from the root . ( Remember, only root can execute the above command . To be more precise , to use the +/- i option , you need root privileges. )

Then try deleting the file

[root@spider lavanya]# rm -rf let.txt
rm: cannot remove `let.txt': Operation not permitted
[root@spider lavanya]#

Wow :) . Something strange . Isn’t it ?? Root has been denied the permission to delete a file :) :)

So how do i revert back to normal . Just use the -i option .

[root@spider lavanya]# chattr -i let.txt
[root@spider lavanya]#

May
04

Dear Tech Support:
Last year I upgraded from Girlfriend 7.0 to Wife 1.0. I soon noticed that the new program began unexpected child processing that took up a lot of space and resources. In addition, Wife 1.0 installed itself into all other programs and now monitors all other system activity. Applications such as Poker Night 10.3, Football 5.0, HuntingAndFishing 7.5, and Racing 3.6. I can’t seem to keep Wife 1.0 in the background while attempting to run my favorite applications. I’m thinking about going back to Girlfriend 7.0, but the uninstall doesn’t work on Wife 1.0. Please help!

Thanks …Troubled User
——-
REPLY:

Dear Troubled User:
This is a very common problem. Many people upgrade from Girlfriend 7.0 to Wife 1.0, thinking that it is just a Utilities and Entertainment program. Wife 1.0 is an OPERATING SYSTEM and is designed by its Creator to run EVERYTHING!!! It is also impossible to delete Wife 1.0 and to return to Girlfriend 7.0. It is impossible to uninstall, or purge the program files from the system once installed. You cannot go back to Girlfriend 7.0 because Wife 1.0 is designed not to allow this. Look in your Wife 1.0 manual under Warnings-Alimony-Child Support. I recommend that you keep Wife 1.0 installed and work on improving the configuration. I suggest installing the background application YesDear 99.0 to alleviate software augmentation.

The best course of action is to enter the command C:\APOLOGIZE because ultimately you will have to do this before the system will return to normal anyway.

Wife 1.0 is a great program, but it tends to be very high maintenance. Wife 1.0 comes with several support programs, such as CleanAndSweep 3.0, CookIt 1.5 and DoBills 4.2. However, be very careful how you use these programs. Improper use will cause the system to launch the program NagNag 9.5. Once this happens, the only way to improve the performance of Wife 1.0 is to purchase additional software. I recommend Flowers 2.1 and Diamonds 5.0, but beware because sometimes these applications can be expensive.

WARNING!!! DO NOT, under any circumstances, install SecretaryWithShortSkirt 3.3. This application is not supported by Wife 1.0 and will cause irreversible damage to the operating system.

WARNING!!! Attempting to install NewGirlFriend 8.8 along with Wife 1.0 will crash the system.

(see Wife 1.0 manual, Apologize, High Maintenance & Secretary with Short Skirt)

Note :: No idea from where i got this one. Found it saved as a text file in one of my servers.
If someone can find the source , please post it here

Apr
19

A program that generates a copy of its own source text as its complete output.

Self reproducting codes are nice and strange :)

I came across these while killing my time in the internet.

I had no clue how these work at that time. But now think i can explain things .

A C program that prints itself.

1.
Author: Unknown (from The Jargon File)
Notes: The first several examples are variations of the standard one-liner C quines.

main(){char*p=”main(){char*p=%c%s%c;(void)printf(p,34,p,34,10);}%c”;(void)printf(p,34,p,34,10);}

The code is bit of obfuscated. So let us first indent it properly, so that it is alteast readable.

main () {
char *p = “main() { char*p =%c%s%c;(void)printf(p,34,p,34,10);}%c”;
(void)printf(p,34,p,34,10);
}

One thing which you might notice here is that 34 and 10 which happens to be ASCII values ” and new line feed respectively.

Sp now p has “main() { char*p =%c%s%c;(void)printf(p,34,p,34,10);}%c” after the execution of the first line . Now the second line has 4 arguments for the print .

Here the first p which occurs in the printf is the format specifier and others are just the arguments . That is , the %c and %s gets expanded in the first p and not in the others

So the output will be generated like this

printf(p, 34, p, 34, 10 ) where p is “main() { char*p =%c%s%c;(void)printf(p,34,p,34,10);}%c”

So here the %c is replaced by in betweeen is replaced by ” while the final %c is replaced by line feed

So it is now like

main() { char*p =”%s”;(void)printf(p,34,p,34,10);}

When the %s is replaced again by p the final statement becomes
main() { char*p =”main() { char*p =%c%s%c;(void)printf(p,34,p,34,10);}%c”;(void)printf(p,34,p,34,10);}

So that gives the final output .

Apr
19

Hello World

Hi all,
This is my new tech blog which i am starting from now on. I am yet another computer science from NIT, Trichy. Think the above statement implies many things like
I am jobless :-) :-)
I dont/neednot/never attend classes regularly :-) :-)
I have never gained anything from what the college teaches me

Think that’s enough about me . Being a compsci student , i would like to start with an simple “Hello World” in comp sci style :-) .

So here i go, Hello World in Hello World in few languages. I have used most of the languages, but few i just copy pasted the code after googling for them
* ADA
with Text_To; use Text_To
procedure hello is
begin
put(“Hello World”);
end hello

* BASIC

10 REM Hello, World in BASIC
20 print “Hello, World!”

* Brainfuck

>+++++++++[<++++++++>-]<.[-]
>++++++++++[<++++++++++>-]<+.[-]
>+++++++++++[<++++++++++>-]<–..[-]
>+++++++++++[<++++++++++>-]<+.[-]
>+++++++[<++++++>-]<++.[-]
>++++++[<+++++>-]<++.[-]
>++++++++++[<+++++++++>-]<—.[-]
>+++++++++++[<++++++++++>-]<+.[-]
>+++++++++++[<++++++++++>-]<++++.[-]
>+++++++++++[<++++++++++>-]<–.[-]
>++++++++++[<++++++++++>-]<.[-]
+++++++++++++.—.-

* C

/* Hello, World! in C */
#include <stdio.h>
int main() {
printf(“Hello, World!\n”);
return 0;
}

* C++

// Hello, World! in C++
#include <iostream>
using namespace std;
int main() {
cout<<”Hello, World”<<endl;
return 0;
}

* C# 1

// Hello, World! in C#
using System;
namespace Hello {
public class HelloWorld {
static void Main() {
Console.WriteLine(“Hello, World!”);
}
}
}

* COBOL

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. hello.
000300 ENVIRONMENT DIVISION.
000400 DATA DAVISION.
000500 PROCEDURE DIVISION.
000600*Hello, World! in COBOL
000700 DISPLAY “Hello, World!”.
000800 STOP RUN

* DCL

$! Hello, World! in DCL
$ WRITE SYS$OUTPUT “Hello, World!”

* DOS batch

REM Hello, World! in DOS batch
@echo off
echo Hello, World!
echo on

* FORTRAN66

c Hello, World in FORTRAN66
PROGRAM HELLO_WORLD
WRITE (*,100)
100 FORMAT (13HHello, World!)
END

* FORTRAN77

c Hello, World in FORTRAN77
PROGRAM HELLO_WORLD
PRINT *,’Hello World’
END

* HTML

<!– Hello, World! in HTML –>
<HTML>
<HEAD>
<TITLE>
Hello, World!
</TITLE>
</HEAD>
<BODY>
Hello, World!
</BODY>
</HTML>

* Java

// Hello, World in Java
class hello_world {
public static void main(String args[]) {
System.out.println(“Hello, World!”);
}
}

* JavaScript

<!– Hello, World! in JavaScript (in HTML) –>
<HTML>
<HEAD>
<TITLE>
Hello, World!
</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=”JavaScript”>
document.write(“Hello, World!”)
</SCRIPT>
</BODY>
</HTML>

* LISP
;;; Hello World in Lisp

(DEFUN HELLO ()
“Hello, World!”
)

* make

# Hello, World! in make
default:
echo Hello, World!

* O’Caml 2

(* Hello, World! in O’Caml *)
print_string “Hello, World!\n”

* Pascal 1

(* Hello, World! in Pascal *)
program HelloWorld(input, output);
begin
writeln(‘Hello, World!’)
end.

* Perl

#!/usr/bin/perl
# Hello, World! in Perl
print “Hello, World!\n”;

* PHP

#!/usr/bin/php
<?php
// Hello, World! in PHP
echo “Hello, World!\n”;
?>

* PHP (in HTML)

<!– Hello, World in PHP (in HTML) –>
<HTML>
<HEAD>
<TITLE>
Hello, World!
</TITLE>
</HEAD>
<BODY>
<?echo(“Hello, World!”);>
</BODY>
</HTML>

* Python

#!/usr/bin/python
# Hello, World! in Python
print “Hello, World!”

* QBASIC

‘ Hello, World! in QBASIC
PRINT “Hello, World!”

* Unix shell 2

#!/bin/sh
# Hello, World! in Unix shell
echo “Hello, World!”

* VBScript (in HTML)

<!– Hello, World in VBScript (in HTML) –>
<HTML>
<HEAD>
<TITLE>
Hello, World!
</TITLE>
</HEAD>
<BODY>
<script language=”vbscript”>
document.write(“Hello, World!”)
</script>
</BODY>
</HTML>

I hope i can add more in this list sometime soon .