Wireless AP  
wifi.png usb.png

My goal here is to make my laptop into a wireless access point — like a wireless router, but without buying an extra box. I'm running Debian Linux. My laptop is connected to the internet by LAN. The first challenge is to find a wireless card that can do Master mode (that is, can work as an access point). Only a few drivers supporr this (see http://linuxwireless.org/en/users/Drivers). After searching, I found a USB wifi card that works — the NEC Aterm WL300NU-AG, which uses the carl9170 driver (see http://linuxwireless.org/en/users/Drivers/carl9170).

nec.box.jpg nec.card.jpg

Two packages are needed: hostapd and udhcpd. Any DHCP server would work, and there are several alternatives to udhcpd. I haven't tested them, but dnsmasq and dhcp3-server were mentioned elsewhere.

# aptitude install -P hostapd
# aptitude install -P udhcpd

The network card can't be placed in AP mode the old way, because the drivers don't support it. When I tried, it produced an error.

# iwconfig wlan1 mode Master
Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Invalid argument.

The driver for this card can do AP mode, but only using hostapd. Here's my configuration for hostapd v0.7.3. I'm not using any encryption or security at the moment — this is an open access point.

/etc/hostapd/hostapd.conf:

interface=wlan1
driver=nl80211
ssid=Openwifi
channel=1
hw_mode=g
ignore_broadcast_ssid=0
auth_algs=1
wpa=0
logger_syslog=-1
logger_syslog_level=2
debug=0
busybox.png

To make my wireless devices connect to the access point smoothly, I use udhcpd v1.18.5-1, a small DHCP server that's part of BusyBox. The below DNS addresses are for OpenDNS and Google Public DNS.

/etc/udhcpd.conf:

start 192.168.0.10
end 192.168.0.50
max_leases 30
interface wlan1
option subnet 255.255.255.0
option domain local
option lease 864000
option router 192.168.0.1
option dns 208.67.222.222
option dns 208.67.220.220
option dns 8.8.8.8
option dns 8.8.4.4

To start the services, use the following commands. These daemons log to /var/log/daemon.log.

# /etc/init.d/hostapd start
# /etc/init.d/udhcpd start
# ifconfig wlan1 inet 192.168.0.1

Check that the daemons are running without error and that the network interface is locally accessible.

# tail --lines=30 /var/log/daemon.log
# ping 192.168.0.1

To get IP masquerading (routing) working, use the following commands. Note that eth0 is the internet-facing interface. Add the following lines to /etc/rc.local to run them at boot time.

# echo "1" > /proc/sys/net/ipv4/ip_forward
# iptables -F
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

That's all there is — my access point is up and running. If everything is working, connect to the wireless access point using a second machine. If it doesn't appear to work, for a starting point, check the local network, the internet using IP addresses, and the internet using domain names.

# ping 192.168.0.1
# ping 8.8.8.8
# ping wikipedia.org
rj45.png server.png antenna.png
by-sa.png
This blog entry is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. For attribution of this work, link to this page and include my name, Douglas P Perkins.

Time  
Place Time Date

JavaScript based on code by Stijn Strickx at http://www.proglogic.com/code/javascript/time/worldclock.php.


No censorship  
no_censorship.jpg

Contact  
identica.png twitter.png

I'm on identi.ca (@dper) and Twitter (@dpp0). My identi.ca account cross posts to my Twitter account, so my content on the two is almost the same. Also, email is good.

contact.png
wikimedia.png wikitravel.png
by.png
This blog entry is licensed under a Creative Commons Attribution 3.0 Unported License. For attribution of this work, link to this page and include my name, Douglas P Perkins.

Pictures on cellphones  

Here's how to take images from your computer and put them on a Docomo FOMA P703iu cellphone. The phone can read microSD cards, and using a microSD/SD adapter, so can the computer.

Of course, you can grab images from the internet using the phone directly. In that case you don't need a microSD card, but there's less storage and you pay for bandwidth.

p703iu.outside.jpg p703iu.inside.jpg 2009.microsd.jpg

Put your microSD card in the adapter and put that in the computer. Make the following directory: /path_to_card/dcim/999_pana. Use any 3-digit number instead of 999.

Choose an image to put on your phone. Convert it jpg. According to the FOMA P703iu manual, the maximum dimensions are 1632x1224 and the maximum image size is 700kBytes. To resize and convert, use a program like the GIMP or ImageMagick. According to the manual, the phone supports gif as well as jpg, but my phone can't display gif at normal resolution.

Copy the jpg to /path_to_card/dcim/999_pana. Rename the jpg to STIL0010.JPG. Use any 4-digit number instead of 0010.

Put the microSD card in your camera and try to view the picture. メニュー → DataBOX → My picture → 6. microSD. The picture should show up. If the file is listed but not viewable, maybe your image format is wrong. If the file isn't listed, maybe it's too big, maybe the file name is wrong, or maybe the directory name is wrong.

by.png
This blog entry is licensed under a Creative Commons Attribution 3.0 Unported License. For attribution of this work, link to this page and include my name, Douglas P Perkins.

Default settings  
vim.gif

.vimrc:
set uc=0
set nobackup
set nowritebackup
set noswapfile
set nomodeline
syn on

.Xmodmap:
!Swap caps lock and escape
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock

keyboard.png

On the Kinesis keyboard, Progrm + \ turns off sound for all regular keys. Progrm + - turns off Caps Lock and Num Lock sound.

terminal.png

.bash_profile:
# Colors.
NC='\e[0m'
black='\e[0;30m'
BLACK='\e[1;30m'
red='\e[0;31m'
RED='\e[1;31m'
green='\e[0;32m'
GREEN='\e[1;32m'
yellow='\e[0;33m'
YELLOW='\e[1;33m'
blue='\e[0;34m'
BLUE='\e[1;34m'
magenta='\e[0;35m'
MAGENTA='\e[1;35m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
white='\e[0;37m'
WHITE='\e[1;37m'

# A prompt showing the current directory.
PS1="\[$GREEN\]\W \[$BLUE\]$\[$NC\] "

scim-anthy.png

.bash_profile or /etc/profile or (on Gentoo) /etc/env.d/99local:
# Enable scim-anthy for Japanese character input.
export XMODIFIERS='@im=SCIM'
export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"

mercurial.png

.hgrc:
[extensions]
color =

[defaults]
pull = --verbose --update --debug
update = --verbose
push = --verbose --debug
commit = --verbose

conky.png

.conkyrc:
cpu_avg_samples 2
net_avg_samples 2
out_to_console no
use_xft yes
xftfont Courier New:size=12
xftalpha 0.1
own_window yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_argb_visual yes
own_window_argb_value 100
update_interval 1
double_buffer yes
draw_shades no
draw_outline no
draw_borders no

default_color white
default_shade_color black
default_outline_color white

alignment bottom_right
gap_x 10
gap_y 10

use_spacer right
no_buffers yes
uppercase no

TEXT
${time %A, %B %d}${alignr}${time %H:%M}
${nodename}  -  ${sysname} ${kernel}  on  ${machine}

Battery: ${battery_percent}%
Uptime:  ${uptime}
CPU:     ${cpu}% (${freq_g}GhZ, ${execi 5 acpi -t |grep 'Thermal 0' |cut -b 16-19}°C) ${alignr}${cpugauge 15,30}
${cpugraph}
Memory:  ${memperc}% (${mem} of ${memmax})
${membar 5}
Swap:    ${swapperc} (${swap} of ${swapmax})
${swapbar 5}
${color slate grey}
(CPU) NAME         PID   CPU%   MEM%
${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}

(MEM) NAME         PID   CPU%   MEM%
${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${color}
(eth0)  ▲ ${upspeedf eth0} kB/s ▼ ${downspeedf eth0} kB/s
(wlan0) ▲ ${upspeedf wlan0} kB/s ▼ ${downspeedf wlan0} kB/s
        Mode:  ${wireless_mode wlan0}
        Essid: ${wireless_essid wlan0}
        AP:    ${wireless_ap wlan0}
${color slate grey}
/     ${fs_used /}/${fs_size /} (${fs_used_perc /}%) ${fs_bar 5 /}
/home ${fs_used /home}/${fs_size /home} (${fs_used_perc /home}%) ${fs_bar 5 /home}

transmission.png

The following does forwarding to the transmission daemon when browsing to /transmission/web/, where the daemon should be running. It is also necessary to enable mod_proxy in lighttpd. It would be appropriate to put access control somewhere in lighttpd.conf. By default, the daemon listens for local requests on port 9091, and using this, one can access it remotely. The transmission daemon is quite picky about its location — even a slight variant of this may fail.

/etc/lighttpd/lighttpd.conf:
...
$HTTP["url"] =~ "^/transmission/" {
  proxy.server = ( "" => ( (
                   "host" => "127.0.0.1",
                   "port" => 9091
                 ) )
  )
}
...
by.png
This blog entry is licensed under a Creative Commons Attribution 3.0 Unported License. For attribution of this work, link to this page and include my name, Douglas P Perkins.