Skip to main content

Posts

SQLITE commands

 Create a database with the name rahultest rahul@rahul-Inspiron-3542:~$ sqlite3 rahultest.db SQLite version 3.8.11.1 2015-07-29 20:00:57 Enter ".help" for usage hints. ========================================= Show the databases sqlite> .databases seq  name             file                                                     ---  ---------------  ---------------------------------------------------------- 0    main             /home/rahul/rahultest.db                ...

POSTGRES COMMANDS

1. Create your own database on provided server. Name it DB_yourname.    postgres=# create user db_rahul with password 'abcd'; CREATE ROLE postgres=# postgres=# postgres=# create database db_rahul with owner db_rahul; CREATE DATABASE postgres=#   2. Create table, where you have 3 columns: 'ID', 'Name', 'Organization', 'department' Fill in this table with data - create 3 records.      postgres=# \c db_rahul You are now connected to database "db_rahul" as user "postgres". db_rahul=# create table customer ( id int not null, db_rahul(# name text not null, db_rahul(# organization text not null, db_rahul(# department text not null ); CREATE TABLE db_rahul=# insert into customer (id,name,organization,department) values (1,'rahul','datacom','Cloud'); INSERT 0 1 db_rahul=# insert into customer (id,name,organization,department) values (2,'vishnu','datacom','Cloud'); INSERT 0 1...

Budget calculator in Python

Today we friends have faced trouble when making tally of  the amount we have paid for the new flat advance, the amount company provided, the money given to broker. So planned to make a budget calculator names=[] def fun(numbers):            while True:                      x=raw_input("if done enter stop:   ")                      numbers.append(x)                      if x == 'stop':                                    break      ...

Create a custom linux shell with limited customized commands

Here is a c Program I have tried to create  a custom shell in linux with limited commands #include #include #include #include #include using namespace std; int main(int argc, char * argv[]) {   string command; cout << "\t This is a custom developed shell \n\n"; while (command != "myexit") { if ( command == "myexit") system("exit"); else if ( command == "myfinger" ) { char username[40]; char buf[32]; printf ("Enter the username:\n"); scanf ("%s",&username); sprintf(buf, "finger %s", username); system (buf); } else if ( command == "mydel" ) { char filename[40]; char cmd1[40]; printf ("Enter the filename to delete:\n"); scanf ("%s",&filename); sprintf(cmd1, "rm -rf %s", filename); system (cmd1); printf ("The file %s deleted \n", filename); } else if ( command == "mywhich" ) { char cmmnd[40]; char cmd2[40]; printf ("Enter the c...

Bootable WINDOWS and LINUX Pendrive

 Mount CD/DVD ISO or DVD ITSELF Type the following command to mount Fedora 12 iso image: # mount Fedora-12-x86_64-netinst.iso -o loop /media/cdrom0/ # DVD=/media/cdrom0 # ls -l $DVD Sample outputs: total 6 dr-xr-xr-x 3 root root 2048 2009-11-09 05:37 EFI drwxr-sr-x 3 root 499 2048 2009-11-09 05:37 images drwxr-sr-x 2 root 499 2048 2009-11-09 05:36 isolinux You need to use files stored in isolinux directory to create a bootable usb pen. Format Usb Create the fdisk partition : # fdisk /dev/sdb You need to create only 1 partition. Next format the partition: # USB=/media/usb # mkdosfs /dev/sdb1 Finally mount the partition: # mkdir -p /media/usb # mount /dev/sdb1 /media/usb # USB=/media/usb Copy Required Files Type the following commands: # cp -av $DVD/isolinux/* $USB # cd $USB # rm isolinux.bin boot.cat TRANS.TBL # mv isolinux.cfg syslinux.cfg Also copy the installer's initial RAM disk $DVD/images/pxeboot/initrd.img (for CentOS / RHEL Linux use $DVD/Re...

Comodo CWAF

cd /usr/src rm -rf /usr/src/comodo*  DOwnload  https://docs.google.com/uc?export=download&id=0B_Z7t7PO4imFMU1mVG52c3VGM0k tar xvzf comodobr.tar.gz cp -pa comodo/cwaf_catalog.cgi /usr/local/cpanel/whostmgr/cgi cp -pa comodo/addon_cwaf.cgi /usr/local/cpanel/whostmgr/cgi cp -pa comodo/cwaf /usr/local/cpanel/whostmgr/cgi cp -pa comodo/cwaf_sharedlib.pl /usr/local/cpanel/whostmgr/cgi cp -pa comodo/addon_cwaf.conf /var/cpanel/apps cp -pa comodo/cwaf_var/cwaf /var/cpanel cp -pa comodo/perl5 /opt/cpanel/ /usr/local/cpanel/bin/register_appconfig /var/cpanel/apps/addon_cwaf.conf rm -rf /var/cpanel/cwaf/rules/modsec_nagios.conf mv /usr/local/apache/conf/modsec2.conf /usr/local/apache/conf/modsec2.conf.$(date +%d-%m-%y) rm -rf modsec2.conf Download and update  https://docs.google.com/uc?export=download&id=0B_Z7t7PO4imFSEI5WDFWTHg4eGs yes | mv /usr/local/apache/conf/modsec2.user.conf /usr/local/apache/conf/modsec2.user.conf.`date +%h-%d-%y-%s` DOwnload ...

SOFTACULOUS BACKUP DISABLE

#!/bin/bash if [  -f /tmp/testsoftaculous99999.txt ]; then exit 0 fi sed -i '/disable_backup_restore/ s/...$/ 1;/g' /usr/local/cpanel/whostmgr/cgi/softaculous/enduser/universal.php sed -i '/disable_auto_backup/ s/...$/ 1;/g' /usr/local/cpanel/whostmgr/cgi/softaculous/enduser/universal.php sed -i '/auto_backup_limit/ s/...$/ 1;/g' /usr/local/cpanel/whostmgr/cgi/softaculous/enduser/universal.php sed -i '/max_backups/ s/...$/ 1;/g' /usr/local/cpanel/whostmgr/cgi/softaculous/enduser/universal.php /usr/local/cpanel/bin/cpuwatch 10 find /home/*/ -maxdepth 2 -type d -iname "softaculous_backups" -exec rm -rvf "{}" \; touch /tmp/testsoftaculous99999.txt