2010年11月4日 星期四

git

Enhanced shell prompt
One specificity of git over something lke subversion is that all your branch stay in the same directory.
Thanks to the git completion extensions available in git-core, you can enhance your shell prompt to display the name of the branch you are working on. For example, if you set:

PS1='\u@\h:\w$(__git_ps1 " (%s)") \$ '

2010年11月2日 星期二

Virtualbox

VBoxManage.exe modifyvm "Ubuntu 10.04 for WRL4" --natpf1 "guestssh,tcp,,22,,22


VBoxManage.exe startvm "Ubuntu 10.04 for WRL4" --type headless

2010年10月25日 星期一

network-manager 3g modem debug

NM_SERIAL_DEBUG=1 NM_PPP_DEBUG=1 /usr/sbin/NetworkManager --no-daemon

refer:
http://ubuntuforums.org/showthread.php?t=1466490

https://bugs.edge.launchpad.net/ubuntu/+source/network-manager/+bug/259028

http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?viewmode=thread&topic_id=8730&forum=3&post_id=110840

http://www.facebook.com/note.php?note_id=104520692922518

2010年8月1日 星期日

Ubuntu Customize Kit (uck)

#(get latest uck and unetbootin)
# http://sourceforge.net/projects/uck/files/
# apt-get install unetbootin
#(get latest ubuntu desktop iso)
# http://www.ubuntu.com/desktop/get-ubuntu/download
#(run uck)

# steps:
# choose UCK form Applications
# "zh"
# "en" and "Zh-TW"
# default locale "en"
# locate ISO
# customize ISO manually
# gnome
# enter console ...
echo "deb http://download.virtualbox.org/virtualbox/debian maverick non-free" >> /etc/apt/sources.list
echo "deb http://archive.canonical.com/ubuntu maverick partner" >> /etc/apt/sources.list
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
sh -c 'echo "deb http://archive.getdeb.net/ubuntu lucid-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'
apt-add-repository ppa:tualatrix/ppa
apt-add-repository ppa:ubuntu-wine/ppa
apt-add-repository ppa:chromium-daily/ppa
apt-add-repository ppa:transmissionbt/ppa
apt-add-repository ppa:dnjl/virtualization
add-apt-repository ppa:portis25/ppa
add-apt-repository ppa:fkrull/deadsnakes

oneiric updates
add-apt-repository ppa:ferramroberto/java
http://www.ubuntugeek.com/install-mplayer-and-multimedia-codecs-libdvdcss2w32codecsw64codecs-on-ubuntu-11-10-oneiric.html
http://www.gaggl.com/2011/10/installing-java6-jdk-on-ubuntu-11-10/

#(add universe, universe repository)
sed -i -e "s/^# \(.*multiverse\)$/\1/g" /etc/apt/sources.list
sed -i -e "s/^# \(.*universe\)$/\1/g" /etc/apt/sources.list
apt-get update

#(add mediabuntu)
wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list --output-document=/etc/apt/sources.list.d/medibuntu.list
apt-get update
apt-get --yes -q --allow-unauthenticated install medibuntu-keyring
apt-get update

apt-get install linux-headers-server linux-image-server

apt-get install vim vim-gnome vim-scripts gcin ubuntu-tweak chromium-browser git-svn qgit filezilla virtualbox-3.2 meld deja-dup rapidsvn unetbootin acroread skype pidgin gimp wireshark sun-java6-jdk openssh-server subversion git-cvs multiget wine pcmanx-gtk2 p7zip-full unrar-free exuberant-ctags libelf-dev libreadline-dev autoconf sshfs transmission tree gfxboot squashfs-tools dpkg-dev build-essential mktemp w32codecs libdvdcss2 smplayer non-free-codecs dmraid inkscape netbeans qemu kvm libusb-dev guvcview libsigc++-dev libcurl4-openssl-dev gparted qt4-designer qt4-dev-tools libc6-dev libvdpau-dev wvdial smbfs texi2html texinfo texlive libssl-dev lame curl libbfd-dev intltool xz-lzma xz-utils pac

#(others: uck, Hiradio Tray...)
#(put latest .deb from http://sourceforge.net/projects/uck/files/ on ~/tmp/remaster-apt-cache)
#(Hiradio http://champyen.blogspot.com/)
#(use dpkg -i )

#max/min/close button
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/metacity/general/button_layout ":minimize,maximize,close"
#gconftool -s /apps/metacity/general/button_layout -t string "menu:minimize,maximize,close"

#usb permission
sed -i -e "`grep -n libusb /lib/udev/rules.d/50-udev-default.rules -A 1 | tail -n 1 | cut -d- -f1` s/664/666/" /lib/udev/rules.d/50-udev-default.rules

#(use bash, not dash)
dpkg-reconfigure dash

#(FINISH!!!)
# type "exit" to finish the iso

#(optional: run unetbootin for USB live stick)

uck-remaster是UCK的流程文件,我們可以在」customizing」段加入自定義腳本。

UCK腳本調用流程(參見: uck-remaster文件):
1. 解壓鏡像文件:uck-remaster-unpack-iso
2. 解壓初始化鏡像: uck-remaster-unpack-initrd
3. 解壓根文件系統: uck-remaster-unpack-rootfs
4. 調用自定義腳本。
5. 壓縮初始化包: uck-remaster-pack-initrd
6. 壓縮根文件系統包: uck-remaster-pack-rootfs
7. 製作鏡像文件: uck-remaster-pack-iso
8. 清理: uck-remaster-clean

reference: http://blog.163.com/alex_kame/blog/static/14546748201071022122305/

2010年7月29日 星期四

kernel debug in qemu with eclipse

http://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.html

2010年7月26日 星期一

ubuntu kernel/compile

http://blog.avirtualhome.com/2010/05/05/how-to-compile-a-ubuntu-lucid-kernel/

https://help.ubuntu.com/community/Kernel/Compile

2010年7月13日 星期二

debootstrap

#!/bin/sh
sudo debootstrap --arch=mips --foreign \
--include aptitude,vim,openssh-server,gcc-4.3,python \
lenny /opt/nfsroot/mips http://www.emdebian.org/grip


(On target)
cd debootstrap
./debootstrap --second-stage


(very good step-by-step)
http://nabeko-notebook.blogspot.com/2010/04/emdebian-on-arm-by-debootstrap.html

(locales)
http://www.wayhorn.com/node/8

2010年7月7日 星期三

vpnc

http://ubuntuforums.org/showthread.php?t=1202896

2010年7月1日 星期四

ubuntu fonts

http://playubuntu.blogspot.com/2009/11/ubuntu-910.html

2010年6月22日 星期二

xilinx on ubuntu

http://www.george-smart.co.uk/wiki/Xilinx_JTAG_Linux
http://getglitched.com/?page_id=45

2010年5月26日 星期三

sslvpn

tun module in ubuntu 10.04

sudo apt-get install build-essential linux-headers-`uname -r`
mkdir faketun
cd faketun
echo -e "#include <linux/module.h>\nstatic int start__module(void) {return 0;}\nstatic void end__module(void){return;}\nmodule_init(start__module);\nmodule_exit(end__module);">tun.c
echo -e "obj-m += tun.o\nall:\n\tmake -C /lib/modules/\$(shell uname -r)/build/ M=\$(PWD) modules\nclean:\n\tmake -C /lib/modules/\$(shell uname -r)/build/ M=\$(PWD) clean\nclean-files := Module.symvers">Makefile
make
sudo install tun.ko /lib/modules/`uname -r`/kernel/net/tun.ko
sudo depmod -a
sudo modprobe tun



http://mad-scientist.net/juniper.html

2010年5月19日 星期三

lxr for uboot and linux

git repo with uboot and linux
http://mohammadthalif.wordpress.com/2010/05/09/how-to-setup-lxr/

plain repo
http://royc10000.blogspot.com/2009/10/debian-lxr.html

2010年5月3日 星期一

VPN

http://www.douhua.im/2010/01/06/ubuntu-server-install-openvpn-server/

2010年4月28日 星期三

ssd tunes on Linux

http://thunk.org/tytso/blog/2009/02/20/aligning-filesystems-to-an-ssds-erase-block-size/

http://www.nuclex.org/blog/personal/80-aligning-an-ssd-on-linux

http://ubuntuforums.org/showthread.php?t=1178209

http://www.brighthub.com/computing/linux/articles/9170.aspx

http://en.dogeno.us/2010/01/karmic-with-solid-state-disk-how-to-optimize-ubuntu-for-ssd/

http://ubuntuforums.org/showthread.php?t=1441374

http://aspireonezg5.wordpress.com/2009/10/16/karmic-howto/

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
none /var/tmp aufs noatime,br:/tmp=rw:/var/tmp=ro 0 0
none /var/log aufs noatime,br:/tmp=rw:/var/log=ro 0 0
none /var/cache aufs noatime,br:/tmp=rw:/var/cache=ro 0 0
tmpfs /var/log/apache2 tmpfs defaults,noatime,mode=1777 0 0
none /home/<user>/.cache aufs noatime,br:/tmp=rw:/home/<user>/.cache=ro 0 0

2010年4月16日 星期五

windows xp migration

http://drbl.nchc.org.tw/advanced/fine-print.php?path=./01_DRBL/08-drbl-sanboot.faq

http://drbl.nchc.org.tw/drbl-winroll/

2010年4月12日 星期一

softraid

http://ericbbs.blogspot.com/2009/05/mdadm-raid.html

http://blog.orz101.net/node/169

gdb

link

link

2010年4月11日 星期日

webhost

lighttpd + fastcgi
http://www.cyberciti.biz/tips/lighttpd-php-fastcgi-configuration.html

dropbox
http://forums.dropbox.com/topic.php?id=15558

lighttpd + joomla
http://www.howtoforge.com/installing-joomla-1.5.6-on-a-lighttpd-webserver-debian-etch

web hosting (in chiense)
link

shared host (Virtual host)
http://mediatemple.net/
http://blog.ez2learn.com/2009/07/19/webfaction-plans/
http://www.bluehost.com/

VPS (Xen)
http://www.linode.com/
http://www.slicehost.com/

在 Apache 下設定以 lighttpd 來提供靜態檔案的讀取
http://dannynotebook.blogspot.com/2009/02/apache-lighttpd.html

2010年3月26日 星期五

armcc and gnu

inspired from ffmpeg project's configure file

./configure --cross-prefix=arm-none-linux-gnueabi- --arch=arm --cpu=cortex-a8 --extra-cflags='-mfpu=neon -mfloat-abi=softfp' --sysroot=/opt/CodeSourcery/arm-none-linux-gnueabi/libc --enable-gpl --enable-postproc --enable-avfilter --enable-avfilter-lavf --cc=armcc --target_os=linux

it will generate armcc.conf with

$cc --arm_linux_configure --arm_linux_config_file="$armcc_conf" --configure_sysroot="$sysroot" --configure_cpp_headers="$sysinclude"

and then you can use

armcc --arm_linux_config_file=armcc.conf --translate_gcc

as your GNU compiler without changing makefile (which for armcc originally).

extra readings:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0212a/CHDCIBCA.html

2010年3月25日 星期四

qemu + ubuntu + realview_eb + rootstock

ARM/RootfsFromScratch
https://wiki.ubuntu.com/ARM/RootfsFromScratch

project-rootstock

qemu best practice
http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:qemu

qemu flash support
http://thomas.enix.org/Blog-20081002153859-Technologie

2010年02月17日

ARM QEMU上のDebianを最新のカーネルに差し替えてさらにSMPで動かしてみる



rootstock

2010年3月22日 星期一

substruct with sqlite3

-- Substruct (download)

-- patch it by sqlite3 support (mysql by default).
diff --git a/config/boot.rb b/config/boot.rb
index dd5e3b6..ad28b5a 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -44,7 +44,7 @@ module Rails
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
- Rails::GemDependency.add_frozen_gem_path
+ #Rails::GemDependency.add_frozen_gem_path
end
end

diff --git a/config/database.yml b/config/database.yml
index 796e976..8c4c899 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -14,29 +14,52 @@
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
-development:
- adapter: mysql
- encoding: utf8
- database: substruct_development
- username: root
- password:
- socket: /tmp/mysql.sock
+#development:
+# adapter: mysql
+# encoding: utf8
+# database: substruct_development
+# username: root
+# password:
+# socket: /tmp/mysql.sock

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
+#test:
+# adapter: mysql
+# encoding: utf8
+# database: substruct_test
+# username: root
+# password:
+# socket: /tmp/mysql.sock
+#
+#production:
+# adapter: mysql
+# encoding: utf8
+# database: substruct_production
+# username: root
+# password:
+# socket: /tmp/mysql.sock
+
+# SQLite version 3.x
+# gem install sqlite3-ruby (not necessary on OS X Leopard)
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
test:
- adapter: mysql
- encoding: utf8
- database: substruct_test
- username: root
- password:
- socket: /tmp/mysql.sock
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000

production:
- adapter: mysql
- encoding: utf8
- database: substruct_production
- username: root
- password:
- socket: /tmp/mysql.sock
+ adapter: sqlite3
+ database: db/production.sqlite3
+ pool: 5
+ timeout: 5000
diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb
index c94db0a..54e3661 100644
--- a/config/initializers/new_rails_defaults.rb
+++ b/config/initializers/new_rails_defaults.rb
@@ -11,11 +11,11 @@ if defined?(ActiveRecord)
ActiveRecord::Base.store_full_sti_class = true
end

-ActionController::Routing.generate_best_match = false
+#ActionController::Routing.generate_best_match = false

# Use ISO 8601 format for JSON serialized times and dates.
ActiveSupport.use_standard_json_time_format = true

# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
# if you're including raw json in an HTML page.
diff --git a/vendor/plugins/substruct/db/schema.rb b/vendor/plugins/substruct/db/schema.rb
index ce71f69..2c13378 100755
--- a/vendor/plugins/substruct/db/schema.rb
+++ b/vendor/plugins/substruct/db/schema.rb
@@ -116,8 +116,10 @@ ActiveRecord::Schema.define(:version => 20100210194537) do
t.integer "country_id", :default => 0, :null => false
end

- add_index "order_addresses", ["first_name", "last_name"], :name => "name"
- add_index "order_addresses", ["country_id", "order_user_id"], :name => "countries"
+ #add_index "order_addresses", ["first_name", "last_name"], :name => "name"
+ #add_index "order_addresses", ["country_id", "order_user_id"], :name => "countries"
+ add_index "order_addresses", ["first_name", "last_name"]
+ add_index "order_addresses", ["country_id", "order_user_id"]

create_table "order_line_items", :force => true do |t|
t.integer "item_id"
@@ -145,7 +147,8 @@ ActiveRecord::Schema.define(:version => 20100210194537) do
t.string "name", :limit => 30, :default => "", :null => false
end

- add_index "order_status_codes", ["name"], :name => "name"
+ #add_index "order_status_codes", ["name"], :name => "name"
+ add_index "order_status_codes", ["name"]

create_table "order_users", :force => true do |t|
t.string "email_address", :limit => 50, :default => "", :null => false
@@ -246,7 +249,8 @@ ActiveRecord::Schema.define(:version => 20100210194537) do
t.integer "related_id", :default => 0, :null => false
end

- add_index "related_products", ["product_id", "related_id"], :name => "related_products"
+ #add_index "related_products", ["product_id", "related_id"], :name => "related_products"
+ add_index "related_products", ["product_id", "related_id"]

create_table "rights", :force => true do |t|
t.string "name"
@@ -290,7 +294,8 @@ ActiveRecord::Schema.define(:version => 20100210194537) do
t.integer "parent_id", :default => 0, :null => false
end

- add_index "tags", ["name"], :name => "name"
+ #add_index "tags", ["name"], :name => "name"
+ add_index "tags", ["name"]

create_table "user_uploads", :force => true do |t|
t.string "filename"
diff --git a/vendor/plugins/substruct/app/models/product.rb b/vendor/plugins/substruct/app/models/product.rb
index 655e1c8..c2f9b5c 100755
--- a/vendor/plugins/substruct/app/models/product.rb
+++ b/vendor/plugins/substruct/app/models/product.rb
@@ -2,9 +2,9 @@ class Product < Item
# Conditions that the product is in stock, or available
# and just out of stock.
CONDITIONS_AVAILABLE = %Q/
- CURRENT_DATE() >= DATE(items.date_available)
- AND items.is_discontinued = 0
- OR (items.is_discontinued = 1 AND (items.quantity > 0 OR items.variation_quantity > 0))
+ CURRENT_DATE >= DATE(items.date_available)
+ AND items.is_discontinued = 'f'
+ OR (items.is_discontinued = 't' AND (items.quantity > 0 OR items.variation_quantity > 0))
/

has_many :product_images, :dependent => :destroy
-- my gem list
*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
appengine-jruby-jars (0.0.6)
appengine-rack (0.0.6)
appengine-sdk (1.3.1)
appengine-tools (0.0.10.1)
authlogic (2.1.3)
authlogic-oid (1.0.4)
bundler08 (0.8.5)
cgi_multipart_eof_fix (2.5.0)
columnize (0.3.1)
daemons (1.0.10)
ezcrypto (0.7.2)
fastercsv (1.5.3)
fastthread (1.0.7)
gem_plugin (0.2.3)
google-appengine (0.0.10.1)
json (1.2.3)
linecache (0.43)
mime-types (1.16)
mini_magick (1.2.5)
mongrel (1.1.6)
passenger (2.2.11)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
RedCloth (4.2.3)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.9)
ruby-openid (2.1.7)
rubyzip (0.9.4)
sqlite3-ruby (1.2.5)
wrest (0.1.0)

-- do bootstrap
rake substruct:db:bootstrap

-- go!
script/server

2010年3月8日 星期一

openocd

Require: OpenOCD with Amontec Tiny JTAG.
Target: ARM7, ARM11

For Windows:

For Linux:
1) get source
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
2) install packages for ubuntu
sudo apt-get install libtool automake autoconf texinfo libftdi-dev
3) compile
./bootstrap
./configure --prefix=/opt/openocd/ --enable-ft2232_libftdi --enable-maintainer-mode
make
make install

JTAG:

integration

Eclipse plugin