Thursday, November 12, 2015

Trace Application in Linux

Using Strace,


Installaions "Fedora":
 dnf install strace
Running :
 strace -Tttvfs 1024 -o <output_file> <command>

Tuesday, November 10, 2015

Fortran, C and C++ for Windows

Download from :
http://www.equation.com/servlet/equation.cmd?fa=fortran
and install it or extract it to C:\MinWG and if you use winsock.h or winsock2.h, compile it like below.

Compile the Code with : gcc code.c -lws2_32

this help from IRC channel.
<Love4Boobies> Move the -lws2_32 at the very end.

Thursday, November 5, 2015

Python MySql

 Simple use of MySql Python

mysql> CREATE TABLE pc_data (
    -> pc_id INT NOT NULL AUTO_INCREMENT,
    -> pc_title VARCHAR(100) NOT NULL,
    -> pc_command VARCHAR(100) NOT NULL,
    -> pc_ip VARCHAR(100) NOT NULL,
    -> pc_result VARCHAR(200) NOT NULL,
    -> PRIMARY KEY ( pc_id )
    -> );
cursor.execute("INSERT INTO pc_data ( pc_title, pc_command, pc_ip, pc_result)
                    VALUES ( "PC", "ipconfig", ipaddress, useragent );")
1:

>>import _mysql
>>db=_mysql.connect()
>>db=_mysql.connect(host="localhost",user="joebob",passwd="moonpie",db="thangs")
>>db.query("select * from comPc where com_id = 1")
>>r = db.use_result()
>>r.fetch_row()
(('3','2','0'),)
>>r.fetch_row()
()

2:
>>import MySQLdb
>>db=MySQLdb.connect(passwd="moonpie",db="thangs")
>>c=db.cursor()
>>c.execute("select * from comPc")
>>c.fetchone()
(3L, 2L, 0L)

Flask Reqest environ

 request.environ['  set from below   ']
{'wsgi.multiprocess': False,
'HTTP_X_FORWARDED_SERVER': 'freely-openly.rhcloud.com',
'HTTP_X_FORWARDED_HOST': 'freely-openly.rhcloud.com',
'HTTP_X_CLIENT_IP': '00.00.00.00',
'SERVER_SOFTWARE': 'Werkzeug/0.8.3',
'SCRIPT_NAME': '',
'REQUEST_METHOD': 'GET',
'PATH_INFO': '/',
'SERVER_PROTOCOL': 'HTTP/1.1',
'QUERY_STRING': '',
'werkzeug.server.shutdown': <function shutdown_server at 0x7f303c4c6b18>,
'CONTENT_LENGTH': '',
'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Fedora; Linux i686; rv:41.0) Gecko/20100101 Firefox/41.0',
'HTTP_CONNECTION': 'Keep-Alive',
'SERVER_NAME': '00.00.00.00',
'REMOTE_PORT': 17727,
'wsgi.url_scheme': 'http',
'SERVER_PORT': '8080',
'werkzeug.request': <Request 'http://freely-openly.rhcloud.com/' [GET]>,
'HTTP_X_FORWARDED_PROTO': 'http',
'wsgi.input': <socket._fileobject object at 0x7f303c4ab450>,
'HTTP_DNT': '1',
'HTTP_HOST': 'freely-openly.rhcloud.com',
'wsgi.multithread': False,
'HTTP_CACHE_CONTROL': 'max-age=0',
'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'wsgi.version': (1, 0),
'wsgi.run_once': False,
'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f30409df1e0>,
'REMOTE_ADDR': '127.6.57.1',
'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
'HTTP_X_FORWARDED_FOR': '00.00.00.00',
'HTTP_X_REQUEST_START': 't=1446667986092501',
'HTTP_X_FORWARDED_PORT': '80',
'CONTENT_TYPE': '',
'HTTP_ACCEPT_ENCODING': 'gzip, deflate'}

Java for Linux

Java Downloads for Linux 

https://www.java.com/en/download/linux_manual.jsp

## java ##
alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 200000

## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000

## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 200000

## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 200000

## Install javac only if you installed JDK (Java Development Kit) package ##
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000

Sunday, November 1, 2015

Linux and Unix screen command


Installing in Fedora

yum install screen
Start screen for the first time :
mib@itsecur1ty ~ $ screen

Show screen parameter :

Type “Ctrl-A” and “?” without quotes. Then you will see all commands or parameters on screen.
To get out of the help screen, you can press “space-bar” button or “Enter“.

Re-attach the screen :

mib@itsecur1ty ~ $ screen -r
Use screen -ls to see how many screen are available :
mib@itsecur1ty ~ $ screen -ls
if you want to restore screen :
mib@itsecur1ty ~ $ screen -r "number"
Note : Alternatives to GNU Screen for Linux Terminal :
Tmux and dvtm dtach.