If you need to limit the apt-get / auto update, you can create /etc/apt/apt.conf.d/76download.
Put script bellow into it. Dl-Limit "25" means max download speed will be 25Kbps.
Acquire
{
Queue-mode "access";
http
{
Dl-Limit "25";
};
};
Thursday, July 16, 2009
Sunday, June 07, 2009
dpkg: serious warning: files list file for package `package’ missing, assuming package has no files currently installed
If you have this kind of warning message :
dpkg: serious warning: files list file for package `package’ missing, assuming package has no files currently installed.
You only need to remove and install again the 'package' .
sudo apt-get remove package
sudo apt-get install package
dpkg: serious warning: files list file for package `package’ missing, assuming package has no files currently installed.
You only need to remove and install again the 'package' .
sudo apt-get remove package
sudo apt-get install package
Wednesday, June 03, 2009
To limit your network traffic bandwidth
If you need to limit your network traffic bandwidth.
You need to install iproute-2.6.27-2.fc10.i386 in Fedora .
The original script is from
http://www.torrentflux.com/forum/index.php?topic=2743.0
To use it you need to have root privileged.
E.g.
$ sudo sh tc.sh upload
=======
#!/bin/bash
#
# Created by Discovery for PSA
# Modified by Mige Harimurti
#
# Name of the traffic control command.
TC=/sbin/tc
# The network interface we're planning on limiting bandwidth.
IF=eth0 # Interface
# Download limit (in mega bits)
DNLD=1000mbps # DOWNLOAD Limit
#DNLD=10kbps # DOWNLOAD Limit
# IP address of the machine we are limiting the uploads on.
# IP=192.168.1.101 # Host IP
# Filter options for limiting the intended interface.
# U32="$TC filter add dev $IF protocol ip parent 1:0 prio 1 u32"
start() {
# We'll use Hierarchical Token Bucket (HTB) to shape bandwidth.
# For detailed configuration options, please consult Linux man
# page.
$TC qdisc add dev $IF root handle 1: htb default 10
$TC class add dev $IF parent 1: classid 1:1 htb rate $DNLD burst 15k
$TC class add dev $IF parent 1:1 classid 1:10 htb rate $DNLD ceil $DNLD burst 15k
$TC class add dev $IF parent 1:1 classid 1:20 htb rate $UPLD
$TC qdisc add dev $IF parent 1:10 handle 10: sfq perturb 10
$TC qdisc add dev $IF parent 1:20 handle 20: sfq perturb 10
$TC filter add dev $IF protocol ip parent 1:0 prio 1 handle 10 fw flowid 1:10
$TC filter add dev $IF protocol ip parent 1:0 prio 1 handle 20 fw flowid 1:20
#iptables -t mangle -A OUTPUT -p tcp --sport 1024:65535 -j MARK --set-mark 0x14
iptables -t mangle -A OUTPUT -p tcp --sport 9001 -j MARK --set-mark 0x14
# The first line creates the root qdisc, and the next two lines
# create three child qdisc that are to be used to shape download
# and upload bandwidth.
}
stop() {
# Stop the bandwidth shaping.
$TC qdisc del dev $IF root
iptables -t mangle -F
}
upload() {
read -p 'Enter Upload Speed [e.g.50kbps]: ' UPLD
}
restart() {
# Self-explanatory.
stop
sleep 1
start
}
show() {
# Display status of traffic control status.
$TC -s qdisc ls dev $IF
}
case "$1" in
start)
upload
echo -n "Starting bandwidth shaping: "
start
echo "done"
;;
upload)
#read -p 'Enter Upload Speed in kbps: ' UPLD
upload
echo "Upload is now set to: $UPLD"
echo -n "Restarting bandwidth shaping: "
restart
echo "done"
;;
stop)
echo -n "Stopping bandwidth shaping: "
stop
echo "done"
;;
restart)
echo -n "Restarting bandwidth shaping: "
restart
echo "done"
;;
show)
echo "Bandwidth shaping status for $IF:"
show
echo ""
;;
*)
pwd=$(pwd)
echo "Usage: tc.bash {start|upload|stop|restart|show}"
;;
esac
exit
==============
You need to install iproute-2.6.27-2.fc10.i386 in Fedora .
The original script is from
http://www.torrentflux.com/forum/index.php?topic=2743.0
To use it you need to have root privileged.
E.g.
$ sudo sh tc.sh upload
=======
#!/bin/bash
#
# Created by Discovery for PSA
# Modified by Mige Harimurti
#
# Name of the traffic control command.
TC=/sbin/tc
# The network interface we're planning on limiting bandwidth.
IF=eth0 # Interface
# Download limit (in mega bits)
DNLD=1000mbps # DOWNLOAD Limit
#DNLD=10kbps # DOWNLOAD Limit
# IP address of the machine we are limiting the uploads on.
# IP=192.168.1.101 # Host IP
# Filter options for limiting the intended interface.
# U32="$TC filter add dev $IF protocol ip parent 1:0 prio 1 u32"
start() {
# We'll use Hierarchical Token Bucket (HTB) to shape bandwidth.
# For detailed configuration options, please consult Linux man
# page.
$TC qdisc add dev $IF root handle 1: htb default 10
$TC class add dev $IF parent 1: classid 1:1 htb rate $DNLD burst 15k
$TC class add dev $IF parent 1:1 classid 1:10 htb rate $DNLD ceil $DNLD burst 15k
$TC class add dev $IF parent 1:1 classid 1:20 htb rate $UPLD
$TC qdisc add dev $IF parent 1:10 handle 10: sfq perturb 10
$TC qdisc add dev $IF parent 1:20 handle 20: sfq perturb 10
$TC filter add dev $IF protocol ip parent 1:0 prio 1 handle 10 fw flowid 1:10
$TC filter add dev $IF protocol ip parent 1:0 prio 1 handle 20 fw flowid 1:20
#iptables -t mangle -A OUTPUT -p tcp --sport 1024:65535 -j MARK --set-mark 0x14
iptables -t mangle -A OUTPUT -p tcp --sport 9001 -j MARK --set-mark 0x14
# The first line creates the root qdisc, and the next two lines
# create three child qdisc that are to be used to shape download
# and upload bandwidth.
}
stop() {
# Stop the bandwidth shaping.
$TC qdisc del dev $IF root
iptables -t mangle -F
}
upload() {
read -p 'Enter Upload Speed [e.g.50kbps]: ' UPLD
}
restart() {
# Self-explanatory.
stop
sleep 1
start
}
show() {
# Display status of traffic control status.
$TC -s qdisc ls dev $IF
}
case "$1" in
start)
upload
echo -n "Starting bandwidth shaping: "
start
echo "done"
;;
upload)
#read -p 'Enter Upload Speed in kbps: ' UPLD
upload
echo "Upload is now set to: $UPLD"
echo -n "Restarting bandwidth shaping: "
restart
echo "done"
;;
stop)
echo -n "Stopping bandwidth shaping: "
stop
echo "done"
;;
restart)
echo -n "Restarting bandwidth shaping: "
restart
echo "done"
;;
show)
echo "Bandwidth shaping status for $IF:"
show
echo ""
;;
*)
pwd=$(pwd)
echo "Usage: tc.bash {start|upload|stop|restart|show}"
;;
esac
exit
==============
Tuesday, March 17, 2009
Sending simple email using python
Source http://snippets.dzone.com/posts/show/658
In my case, I can send simple email using smtplib but the I received empty/blank email which is without From/To/Body appeared on my email client (Thunderbird).
So you need to wrap your email with email.MIMEText as sample codes bellow:
In my case, I can send simple email using smtplib but the I received empty/blank email which is without From/To/Body appeared on my email client (Thunderbird).
So you need to wrap your email with email.MIMEText as sample codes bellow:
import smtplib
from email.MIMEText import MIMEText
def sendTextMail(to,sujet,text,server="localhost"):
fro = "Expediteur"
mail = MIMEText(text)
mail['From'] = fro
mail['Subject'] =sujet
mail['To'] = to
smtp = smtplib.SMTP(server)
smtp.sendmail(fro, [to], mail.as_string())
smtp.close()
sendTextMail("toto@titi.com","hello","cheers")
Warning: mkdir() [function.mkdir]: Permission denied on Fedora
Source http://gallery.menalto.com/node/42302#comment-176477
The problem in my case was that I had the SELinux's security features enabled in my Fedora Core 4 setup. I switched SELinux to permissive mode by editing /etc/sysconfig/selinux -
putting SELINUX=permissive.
There's probably a nicer way than just disabling the security but I was after a simple solution. SELinux FAQ is here.
You need to reboot to make it effective.
The problem in my case was that I had the SELinux's security features enabled in my Fedora Core 4 setup. I switched SELinux to permissive mode by editing /etc/sysconfig/selinux -
putting SELINUX=permissive.
There's probably a nicer way than just disabling the security but I was after a simple solution. SELinux FAQ is here.
You need to reboot to make it effective.
Friday, January 16, 2009
IBM Lotus Symphony
One more alternative for free Office Suite on Ubuntu Linux is IBM Lotus Symphony.
We can get it on http://symphony.lotus.com/ .
We can get it on http://symphony.lotus.com/ .
Thursday, January 15, 2009
Setting up Bridged Network
I need to set up bridged network for my VirtualBox guess OS to have a network connection attached to host interface.
So I install bridge-utils package :
I need to add some lines in /etc/network/interfaces
You have to bring up br0 manually for now.
I think, that's it. VirtualBox 2.1.0 doesn't need TAP or TUN interface.
br0 will recognized in the Host Interface list in network setting part for guess OS.
Due to I set my br0 to static IP, I also need to set my network interface in guess OS to static IP (e.g 192.168.10.101) .
So I install bridge-utils package :
$ sudo apt-get install bridge-utils
I need to add some lines in /etc/network/interfaces
auto br0
iface br0 inet static
address 192.168.10.102
netmask 255.255.255.0
bridge_ports eth0
You have to bring up br0 manually for now.
sudo /etc/init.d/networking restart
sudo ifup br0
I think, that's it. VirtualBox 2.1.0 doesn't need TAP or TUN interface.
br0 will recognized in the Host Interface list in network setting part for guess OS.
Due to I set my br0 to static IP, I also need to set my network interface in guess OS to static IP (e.g 192.168.10.101) .
Wednesday, January 07, 2009
Disable Touchpad on Gnome
It's annoying when you typing some thing suddenly your pointer fly-away somewhere else coz you inadvertently touch the touch-pad with part of your hand.
There are two way to disable/enable thouchpad in Gnome :
1. Go to menu on "System" -> "Preferences" -> "Mouse"
Click on "Touchpad" tab and [un]check "enable Touchpad" below "General" section.
2. Open Terminal [Command line box / console].
To disable, execute :
To enable, execute :
There are two way to disable/enable thouchpad in Gnome :
1. Go to menu on "System" -> "Preferences" -> "Mouse"
Click on "Touchpad" tab and [un]check "enable Touchpad" below "General" section.
2. Open Terminal [Command line box / console].
To disable, execute :
gconftool -t bool -s /desktop/gnome/peripherals/mouse/touchpad_enabled "f"
To enable, execute :
gconftool -t bool -s /desktop/gnome/peripherals/mouse/touchpad_enabled "t"
Subscribe to:
Posts (Atom)