Squid set download limit and prevent downloads by extension

200px-Squid-cache_logo

 

 

 

 

 

Open squid.conf file

sudo vim /etc /squid3/squid.conf

search for reply_body_max_size you can see a line like this

reply_body_max_size 10 MB it will limit the download by 10 MB.

This option specifies the maximum size of a reply body. It can be  used to prevent users from downloading very large files, such as MP3’s and movies.

To prevent download of a particular file type you can use regular expressions

acl mp3_ext url_regex -i \.mp3$

This acl is to prevent mp3 downloads.The http_acces for this acl is

http_access deny mp3_ext

To prevent youtube streaming

acl flash rep_mime_type video/x-flv

and the http_acces

http_reply_access deny flash

We can group different types and write it in a file and can be asked to block

acl denied_filetype url_regex "/etc/squid3/denied_filetype"

Now the types written in the file denied_filetype will be blocked with the below http_access

http_access deny denied_filetype

 

Advertisements

Fixing arduino stk500_recv(): programmer is not responding error

Screenshot from 2012-12-13 12:19:59

avrdude: stk500_recv(): programmer is not responding

In Debian squeeze and Ubuntu you may get an error like this while trying to upload your program…..To fix this error

First install arduino software with all its dependencies from the package manager

sudo apt-get install arduino arduino-core

Next, we’ll get a compatible (2.2pre2-3 or newer) version of librxrt-java to allow Java to handle the I/O (rx/rt);

you can check the files at this link

http://ftp.debian.org/debian/pool/main/r/rxtx/

Now download the file

wget http://ftp.debian.org/debian/pool/main/r/rxtx/librxtx-java_2.2pre2-11_i386.deb
sudo  dpkg  -i  librxtx-java_2.2pre2-11_i386.deb

Now add yourself to the ‘dialout’ group:

sudo adduser `whoami` dialout

and log out and log back in, or reboot.  This is necessary for access to the serial (USB) port.

download the Arduino software, with it’s recent 1.0 release, from the Arduino.cc website.

We extract that software, enter the folder, and run the software:

tar -xvzf  arduino-1.0-linux.tgz
cd arduino-1.0/
./arduino

Plug in your Arduino board via USB to your computer, wait a few seconds to register the new device, and again launch the Arduino software:

 ./arduino

Go to the Tools menu, Board submenu, and select whatever your board is
Finally, again click the Tools menu, Serial Port submenu, and select correct device.

Now try uploading….. 🙂
Happy Hacking 🙂

Backup using dd command

To backup an entire hardisk

#dd if=/dev/sda of=/dev/sdb

sda is the source hardisk and sdb is the external hardisk to which am taking backup

“if” represents input file and “of” respresents output file….

if we give parameter “conv=noerror” then it will continue to copy if there are read errors…else command may fail due to read error

#dd if=/dev/sda of=/dev/sdb conv=noerror

To make image of a hardisk

#dd if=/dev/sda of=~/Desktop/hd_img.iso

Consider am having a bootable usb with a custom OS with some settings saved in it…To make an image of that

Make image of the bootable usb

#dd if=/dev/sdb of=~/Desktop/puppy.img

The above command will make an image of the bootable usb
Now connect the blank usb and make it bootable

dd if=~/Desktop/puppy.img of=/dev/sdb oflag=direct

Always run dd command as root user…use df command to know the drives else you may loose the data…

How to fix Apache – “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Error on Ubuntu

How to fix Apache – “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” Error on Ubuntu

 

 

 

edit the /etc/apache2/httpd.cong

$sudo vim /etc/apache2/httpd.conf

usually it will be blank…add the following to httpd.conf

ServerName localhost

if httpd.conf contains some data then add at the top like this…

ServerName localhost
<Directory /var/www>
Options Indexes Includes FollowSymLinks MultiViews
#AllowOverride AuthConfig
AllowOverride all
Order allow,deny
Allow from all
</Directory>

Now restart apache the problem is fixed 🙂

$sudo /etc/init.d/apache2 restart

Latex IEEE tunefonts error

After installing the IEEEtrans i started to make my document and encountered with IEEEtunefonts error.During compiling the error message appeared like this…

or you may get the following error also

IEEEtran.cls:366:Font OT1/ppl/m/n/10=pplr7t at 10.0pt not loadable: Metric (TFM) file not found.

then install the font package on ubuntu using the command:

sudo apt-get install texlive-fonts-recommended

This fixed the issue for me 🙂

Get IEEE class in Latex

You must need latex preinstalied in your system to do this …if you dont have latex use this command

sudo apt-get install texmaker

Texmaker is latex ide while installing ide it also installs the sufficient packages…

Next how to install IEEE templates in latex so as to get IEEE class…

Download the template from http://www.ieee.org/conferences_events/conferences/publishing/templates.html select the unix packages

Extract this file in a folder IEEEtran.

create a subdirectory “bibtex” in that folder

Download the bibtex file “IEEEtranBST1.tar.gz” from the same  site to this directory and extract

Move IEEEtran directory to /usr/share/texmf-texlive/tex/latex/ if you are in same folder you can use this command

sudo  mv  IEEEtran  /usr/share/texmf-texlive/tex/latex/

run this command next

sudo texhash

you can see your templates get added to the Latex

Now you can start your latex document like this

\documentclass{IEEEtran}

Share Folder of a user in Ubuntu server and access that folder from Windows

Using the software samba we can share Linux folders in windows.When you share your home directory, all contents in that directory will be made available remotely from any system that uses Samba.First i added a dummy user named “test”.you can change this username with the name you want.

This dummy user “test” will be having a hoem directory and the usual folders like Documents,Pictures,Music etc ..Users are added like this…

sudo adduser test

Now install samba

sudo apt-get install samba smbfs

After installing samba, run the command below to edit smb.conf file.

sudo gedit  /etc/samba/smb.conf

uncomment the line ( # ) security = user

Next, scroll down and uncomment ( ; ) the lines shown below and save the file.

Now add user account to samba database

sudo smbpasswd -a test
 Change the “test” by the USERNAME you need.
Now edit the smb.conf
sudo gedit  /etc/samba/smb.conf
 And add the following changes
[sharetest]
comment = testing the share
path = /home/test/Desktop/
browseable = yes
read only = no
guest ok = no
force user = test

Now restart samba using the command

sudo /etc/init.d/smbd restart
or
sudo service smbd restart

Now everything is ready on our ubuntu server.Now going on to our windows client machine.Select network places so that our server will be listed in there

Here i selected the server “GANESH-Desktop” select yours accordingly.From there i selected the folder sharetest the name i gave in smb.conf.

Then the prompt asks for username and pass give that and you will be driven

to the server shared folder here the Desktop…

Now i pasted a jpg image in that shared folder and lets see in ubuntu server…..it works fine one windows xp machine also…
It works!!!! Happy Hacking 🙂