Search This Blog

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, October 17, 2013

BeagleBone Black



Compared with Rasparry Pi, Beaglebone Black looks more developer friendly and more powerful. Remember to order extra hardware (temperature sensor,sound buzzer, LEDs, simple LCD screen,power supply etc) with your Beaglebone Black together, so you can use your Beaglebone to control them.

You will pay around $120, nice price to pay for teaching yourself embedded programming. For example, write your own electronic thermometer. :)





Monday, January 14, 2013

FreeNAS GUI Update

FreeNAS (GUI) Web-based upgrade  from 8.3.0  Release to 8.3.1 Beta2



1. Back up the configuration “System → Settings → General → Save Config”

2. Download the *.txz file. Upload it through the GUI,  Remember to specify the checksum.

 

3. Take about 5~10 minutes flashing the USB key, the machine reboots once, and I manually reboot it again


Old services are up and running after the upgrade. (Say the old config are good)


reference
http://doc.freenas.org/index.php/Upgrading_FreeNAS%C2%AE

Tuesday, January 17, 2012

Django, Force Https on Django Admin in Apache


Encrypt all network traffic going through Django admin pages.
i.e. All pages http://yoursite.com/admin/ANY_PAGES will be redirected to
secure pages https://yoursite.com/admin/ANY_PAGES


Just add a redirect match to your httpd.conf file. For example, in Ubuntu (/etc/apache2/sites-available/your_config_file) you can do:

RedirectMatch ^/admin.* https://yoursite.com/admin

Friday, September 30, 2011

Acer Aspire WIreless Network in Ubuntu


If you have the install media (e.g. ubuntu install cd), you can set up your wireless network.

https://help.ubuntu.com/community/WifiDocs/Driver/bcm43xx
http://code.google.com/p/mixtools/downloads/detail?name=acer-aspire3000-wireless.zip&can=2&q=#makechanges

b43 - No Internet access


If you do not have any other means of Internet access on your computer, you will have to install b43-fwcutter and patch packages from the install media. After that you will need to setup firmware manually (without the firmware automatically downloading and being set up).
Setp 1.
b43-fwcutter is located on the Ubuntu install media under ../pool/main/b/b43-fwcutter/ and patch is located under ../pool/main/p/patch/ or both in the official repositories online.
Note: In some versions (10.04 and 11.04 at least) there is not a /pool/main/p/patch/ If this file is missing then you don't need it. In this case you only need to install /pool/main/b/b43-fwcutter by following the instructions below.
Double click on the package to install or in a terminal (under the desktop menu Applications > Accessories > Terminal) navigate to the folder containing the package and issue the following command:
:/b43-fwcutter/$ sudo dpkg -i b43-fwcutter*

In case you couldn't find the folder, wubi keeps it as a hidden folder so you have to mount it. Follow these steps:
~$ sudo mount -o loop /host/ubuntu/install/.fuse_hidden0000000400000001 /mnt
~$ cd /mnt/pool/main/b/b43-fwcutter/
~$ sudo apt-get install b43-fwcutter
~$ sudo dpkg -i b43-fwcutter*

As for the patch:
~$ cd /mnt/pool/main/p/patch/
~$ sudo apt-get install b43-fwcutter

Then unmount:
~$ sudo umount /mnt

Step 2.
On a computer with Internet access, download the required firmware files from http://downloads.openwrt.org/sources/wl_apsta-3.130.20.0.o and http://mirror2.openwrt.org/sources/broadcom-wl-4.150.10.5.tar.bz2
Step 3.
Copy the downloaded files to your home folder and execute the following commands consecutively in a terminal to extract and install the firmware:
~$ tar xfvj broadcom-wl-4.150.10.5.tar.bz2
~$ sudo b43-fwcutter -w /lib/firmware wl_apsta-3.130.20.0.o
~$ sudo b43-fwcutter --unsupported -w /lib/firmware broadcom-wl-4.150.10.5/driver/wl_apsta_mimo.o

Step 4.
Under the desktop menu System > Administration > Hardware/Additional Drivers, the b43 drivers can be activated for use.
Note: A computer restart may be required before using the wifi card.


Thursday, September 1, 2011

Simple Password Protect with Apache

Apache offers a simple way to protect your web server directory.
you will need two files:
.htpasswd (this is your username and password file)
.htaccess (put this on the directory you want to protect)

htpasswd -c .htpasswd pick_a_user_name
create a


.htaccess
AuthType Basic
AuthName "your popup messages"
AuthUserFile /path/to/your/.htpasswd
Require user the_user_name_you_pick


done !


Sunday, May 15, 2011

OpenSource: RKHUNTER

If you have a good root password, your Unix/Linux core system should be pretty secure. For additional security audit, try rkhunter which scan rootkit, hidden folders, network backdoor, and several configuration file like sshd.



rkhunter --check

Thursday, May 5, 2011

Useful Commands, a script to keep your ssh session alive

Sometimes you don't have the permission to modify your sshd.conf. Just run a simple scrip forever to keep your ssh session alive:


sh  -c 'while echo "alive" > /dev/null; do sleep 20; done' &

Sunday, April 24, 2011

How to change directory using shell script

If you want to change the directory using a shell script (like a bookmark), you need to invoke the script with source, or put a "." to run your script. e.g.

#myscript.sh
cd ~/source/myproject                                                      
export PYTHONPATH=$PWD/lib   



to run it, with:
source myscript.sh
or
. myscript.sh

Friday, April 22, 2011

Useful Commands, swapoff swapon

If you know what you are doing, and you would like to flush your swap memory.

flush the swap:
swapoff -a

turn on the swap:
swapon -a

Sunday, February 20, 2011

Linux, Get Your Linux to Send Email with your Google account in 1 minute


For many users who already have Gmail accounts (or other email accounts), why not just use Gmail to deliver email for you if you simply want to send email from your machine? ssmtp is a very nice MTA to do this, securely.

sudo apt-get install ssmtp heirloom-mailx

edit your /etc/ssmtp/ssmtp.conf

root=youremail@gmail.com
mailhub=smtp.gmail.com:587
UseSTARTTLS=yes
UseTLS=yes
AuthUser=youremail@gmail.com
AuthPass=yourgmailpassword

Now run a simple test, send a email from your machine
echo "SSMTP" | mailx -s 'Hi' youremail@gmail.com

You are done!
Also, get the right permission to secure your password.
http://wiki.freebsd.org/SecureSSMTP
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500454

Now you can even use your editor such as emacs to send email.
  • C-x m (compose a email)
  • fill the email header and body
  • C-c C-s (send email)
done!

why not Sendmail or Postfix?
They are overkill. and good luck maintaining your own SMTP server :)
If you want your lovely Linux box to send email, you need to configure it as a mail server. That means you want to install/configure a SMTP server on your machine. Sendmail and Postfix are the powerful Mail Transfer Agent (MTA) to install for this purpose. The are ridiculously powerful to send and receive mail, with the cost that you might spend hours on configuration.

Saturday, February 19, 2011

Install Programs without Root

Say you want to install lynx
install in $Home/bin

compile your ncurse,
./configure --prefix=$HOME/bin && make install clean

Compile lynx from source, and use the ncurse library you just compiled

env CFLAGS="-I/home/user/bin/include/ncurses" LDFLAGS="-L/home/user/bin/lib" LIBS="-L/home/user/bin/lib -lncurses" ./configure --prefix=$HOME/bin

The trick is, set the environment variable so the build scripts can find the include files and lib files.

Friday, February 18, 2011

Useful Commands, Mount FreeBSD ufs in Linux

Linux supports read on FreeBSD ufs filesystem.
You can mount them with:

sudo mount -r -t ufs -o ufstype=ufs2

for example:
sudo mount -r -t ufs -o ufstype=ufs2 /dev/sdb1 /mnt

Friday, August 20, 2010

Ubuntu, Wireless Network Is Unstable


On Ubuntu 10 (Ubuntu Lucid), the default network manager does not handle wireless network well. Many people reports that their connections often drop after 5 or 10 minutes. A very quick way to fix it is to use another network manager: wicd

For example, to wake up your wireless network for your Acer Aspire network interface (Brodcom):
  1. Install ndiswrapper.
  2. Install the Brodcom driver. (the official documentation explains well).
  3. sudo apt-get install wicd. (and then remove or disable the default network manager)
After that the wireless network on Ubuntu Lucid no longer drops.

Ubuntu, Fix Lagging on SIS Video Card

Many AMD64 and AMD Sempron platform uses SIS chipset. For example, the Acer Aspire product line which use AMD technology. This integrated video card often cause lagging problem on the fresh installed Ubuntu. (Ubuntu Lucid and Ubuntu Jaunty). If you see delay when dragging your window or when watching YouTube video, there is a good chance to fix it by using "vesa" driver for your X server.
  1. First, generate your xorg.conf. So Ubuntu will use it.
  2. Second, in your xorg.conf, change "sis" to "vesa" in your driver section.
vesa driver might not fully utilize the potential of sis chipset, but it usually works better than the sis driver.

reference:
http://www.winischhofer.eu/linuxsispart1.shtml#13

Friday, December 18, 2009

Apache, permission denied to open password file

You set the path of your password file correctly, and permission correctly, but when you still cannot access your password file. The Apache log throws you the error:

Permission denied: Could not open password file:

If you have SELinux running, this could very well mean that SELinux denied the permission for your Apache to read the password file. You must run the following to tell SELinux that your added files can be trusted:

chcon -R -h -t httpd_sys_content_t /var/www/PasswordDir

And then your Apache can read everything under /var/www/PasswordDir.


Note that chcon -R -h -t httpd_sys_content_t /var/www/PasswordDir
httpd_sys_content_t is one of the file types that SELinux recognizes, you can change the file type accordingly when SELinux audits your new files.

OpenSource, Set Up Apache in Fedora 12

Fedora 12 comes with firewall to protect your PC, and therefore setting up Apache will not "just work." Some points to notice are:
  • apache in fedora is called httpd, yum install httpd
  • /etc/init.d/httpd start
  • system-config-firewall, run it as root to open port 80
  • /var/log/httpd/, inside there you can check the Apache log
  • /var/www/html/, is the document root, i.e. http://yourip(or localhost)/
  • /etc/httpd/conf/httpd.conf, is where you can modify your Apache config

Saturday, December 12, 2009

To Do List for installing any Linux

Before installing any Linux/Unix, and after installing Linux/Unix.
  • Make sure your /boot partition is big enough (be safe, make it at least 500MB) so in the future you have enough space to build and store kernels.
  • Consider making partitions for /home, /var. The root partition ("/") should be large enough. I.E. 8GB is small for a desktop install, you will almost always need more.
  • Super Grub Disk is handy for multiple system booting recovery.
  • Backup and fdisk to prepare your hard drive.

Edit:
Emacs
Tex (TeX Live, LaTex)


Terminal:
Tmux (splitting your console)

Internet:
Firefox Sync Bookmark
Extension--Download Status Bar
Extension--No-Script
Extension--Ad Block Plus
Extension--FireBug

Extension--Tor Button
Extension--Privoxy
Flashplayer
JDownloader
QBittorrent
aMule

Development:
Subversion (Sync Your Repository)
GCC
Boost
Qt-Creator
Java
Mono
MonoDevelop

Multimedia:
VLC
RealPlayer
FFmpeg
GIMP

Virtualization:
VirtualBox
QEMU

Server Related:
Apache
FireWall
PHP
Django

Office:
GnuCash Sync GnuCash Book
OpenOffice

Miscellaneous:
Sync Home Directory
DateTime Format:24 or 12
gcin,  cp noseeing to ~/.gcin, im-switch to set gcin as default
Tor
Privoxy
Unrar
Wine
rdesktop (remote control windows from linux)
Ntfs-3g (to see ntfs drive)
yum update (Fedora)
apt-get update (Ubuntu)
portsnap fetch update (FreeBSD)
enable additional repository

Friday, December 11, 2009

Host name lookup failure

ping: cannot resolve google.com: Host name lookup failure

When you put a host (a computer) behind a router, you might suddenly get a "host name lookup failure" even though your network was working a moment ago. You are pretty sure your network is up, your nameserver is working, and you can usually fix it by restarting the host.

You can fix this without restarting a host. The problem is very likely that your host does not use your new router as a default gateway. you simply need to add that as your default route using:

route add default 192.168.1.1

assuming 192.168.1.1 is the router.
you might want to flush the route using route flush

Read the interesting FreeBSD handbook here

More:
check your routing tables with
netstat -r
renew your dhcp lease with
dhclient 192.168.1.100
re-enable your (network) interface with
ifconfig interface up
ifconfig interface down
check your nameserver at
/etc/resolv.conf

Saturday, October 3, 2009

Debugging Firefox 3.5 in Linux

sudo apt-get install firefox3.5-dbg

That is not enough. For Ubuntu, follow the documentation to set up the debug environment.

https://wiki.ubuntu.com/MozillaTeam/Bugs

Tuesday, September 29, 2009

Mouseless Firefox in Gnome

c+k search bar
c+l location (address bar)

c+t new tab
c+w close tab
c+shift+t recently close tab

c+tab next tab
c+shift+tab previous tab

tab next element
tab+shift previous element

alt+ <- back alt+ -> next
Space next page
Home go top

c+r refresh
alt+home go home

' link find
/ quick find
c+g next match

F10 + shortcut letter select menu

c+shift+y download browser

F7 caret browsing
shift select

------------------------
in Gnome:

alt+F2 quick run
alt+F1 menu
c+alt+d show desktop
shift+F10 right click (pop up )

alt+F10 max winddow
alt+F7 move window
alt+F8 re-size window

c+alt+arrow switch workspace