2013年12月19日 星期四

[Git] error: The requested URL returned error: 403 while accessing https://github.com/username/repo.git

今天看了github的教學, 在github新增一個repo
然後在本機端要commit回去, 出現了這個錯誤訊息
error: The requested URL returned error: 403 while accessing https://github.com/username/repo.git

其實這也不奇怪, 預設HTTP是沒有write權限, 所以被擋住也是應該的, 但為什麼github的教學還用這當例子?

所以stackoverflow的人又回答了, 把https改成ssh就好了
1.edit .git/config file under your repo directory
2.find url=entry under section [remote "origin"]
3.change it from url=https://MichaelDrogalis@github.com/derekerdmann/lunch_call.git to url=ssh://git@github.com/derekerdmann/lunch_call.git. that is, change all the texts before @ symbol to ssh://git
4.Save config file and quit. now you could use git push origin master to sync your repo on GitHub

2013年11月17日 星期日

[Git] Permission denied (publickey). fatal: The remote end hung up unexpectedly

今天突然想要抓github上某個專案的某個分支, 語法是這樣
$ git clone -b <branch> <remote_repo>

基本上有兩個作法, 一個是走不需要認證的http, 語法大概是這樣
$ git clone -b my-branch https://git@github.com/username/myproject.git

一個是走ssh, 但需要有public key認證, 語法大概是這樣
$ git clone -b my-branch git@github.com:user/myproject.git

結果ssh的出現了這樣的錯誤
Permission denied (publickey). fatal: The remote end hung up unexpectedly

爬文發現這真是newbie問題阿, github的help就有寫了, 步驟如下
1. 產生ssh keys
$ ssh-keygen -t rsa -C "your_email@example.com"

$ ssh-add id_rsa

2. 將public key提交給github 到Account Settings的"SSH Keys"中, 將public key的內容貼到key欄位

 3. 測試
$ ssh -T git@github.com

如果出現這樣的訊息表示OK啦
Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.

reference:
* Git: clone a specific branch [duplicate]
* Generating SSH Keys

2013年11月9日 星期六

[Linux] Ubuntu 10.04在x220下找不到ethernet

因為Ubuntu 12.04用不習慣, 只好裝回10.04, 但杯具馬上發生, 安裝完後竟然找不到ethernet
dmesg|grep -in eth
沒有網路也沒辦法下載套件,source等, 什麼都沒辦法做, 還好有估到一篇

解決步驟 1. 查詢裝置類型
$ lspci -nn|grep -in eth
5:00:19.0 Ethernet controller [0200]: Intel Corporation Device [8086:1502] (rev 04)
2. 根據vendor id + device id搜尋, 8086是Intel Corporation, 1502是Intel 82579LM Gigabit Network Card

3. 去intel網站下載適合的驅動程式 先搜尋"82579", 再作業系統欄位選擇"Linux", 會得到e1000e-2.5.4.tar.gz

4. 最後就編譯安裝, 重新啟動網路, 搞定, 看到ifconfig有eth0真是太感動了
$ cd e1000e-2.5.4/src$ make
make -C /lib/modules/2.6.32-38-generic/build SUBDIRS=/home/sosorry/driver/e1000e-2.5.4/src modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-38-generic'
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/netdev.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/ethtool.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/param.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/82571.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/ich8lan.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/80003es2lan.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/mac.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/nvm.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/phy.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/manage.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/kcompat.o
  LD [M]  /home/sosorry/driver/e1000e-2.5.4/src/e1000e.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/sosorry/driver/e1000e-2.5.4/src/e1000e.mod.o
  LD [M]  /home/sosorry/driver/e1000e-2.5.4/src/e1000e.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-38-generic'
$ sudo make install
make -C /lib/modules/2.6.32-38-generic/build SUBDIRS=/home/sosorry/driver/e1000e-2.5.4/src modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-38-generic'
  Building modules, stage 2.
  MODPOST 1 modules
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-38-generic'
gzip -c ../e1000e.7 > e1000e.7.gz
# remove all old versions of the driver
find /lib/modules/2.6.32-38-generic -name e1000e.ko -exec rm -f {} \; || true
find /lib/modules/2.6.32-38-generic -name e1000e.ko.gz -exec rm -f {} \; || true
install -D -m 644 e1000e.ko /lib/modules/2.6.32-38-generic/kernel/drivers/net/e1000e/e1000e.ko
/sbin/depmod -a || true
install -D -m 644 e1000e.7.gz /usr/share/man/man7/e1000e.7.gz
man -c -P'cat > /dev/null' e1000e || true
e1000e.
$ sudo /etc/init.d/networking restart


reference: Fix for non-working wired ethernet on Dell Latitude E6520 with Intel 82579 based adapter running Ubuntu 10.04 LTS Lucid

2013年11月3日 星期日

[RPi] vcgencmd commands

vcgencmd是firmware#362371才多出來的新功能, 可以配合參數看一些資訊 首先列出可以用的參數
/opt/vc/bin/vcgencmd commands
commands="vcos, ap_output_control, ap_output_post_processing, vchi_test_init, vchi_test_exit, pm_set_policy, pm_get_status, pm_show_stats, pm_start_logging, pm_stop_logging, version, commands, set_vll_dir, led_control, set_backlight, set_logging, get_lcd_info, set_bus_arbiter_mode, cache_flush, otp_dump, codec_enabled, get_camera, get_mem, measure_clock, measure_volts, measure_temp, get_config, hdmi_ntsc_freqs, hdmi_status_show, pwm_speedup, render_bar, disk_notify, inuse_notify, sus_suspend, sus_status, sus_is_enabled, sus_stop_test_thread, egl_platform_switch, mem_validate, mem_oom, mem_reloc_stats, file, vctest_memmap, vctest_start, vctest_stop, vctest_set, vctest_get"
舉例來說, 想看目前安裝的firmware是哪一個版本
/opt/vc/bin/vcgencmd version
Sep  1 2013 23:27:46 
Copyright (c) 2012 Broadcom
version 4f9d19896166f46a3255801bc1834561bf092732 (clean) (release)
比如說想看目前BCM2835這顆SoC上的溫度
/opt/vc/bin/vcgencmd measure_temp
temp=47.1'C
比如說查看目前可以使用的codec
for codec in H264 MPG2 WVC1 MPG4 MJPG WMV9 ; do \
     echo -e "$codec:\t$(vcgencmd codec_enabled $codec)" ; \
done
H264: H264=enabled
MPG2: MPG2=disabled
WVC1: WVC1=disabled
MPG4: MPG4=enabled
MJPG: MJPG=enabled
WMV9: WMV9=disabled
還有很多可以用的參數, 詳見github

reference:
* RPI vcgencmd usage
* VideoCore Tools

2013年10月15日 星期二

[RPi][轉錄] Building and installing wxPython 2.9.4.0 on Raspberry Pi (Raspbian)

直接紀錄步驟好了

1. 安裝必要的套件
$ sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev

2. 下載source和patch
$ cd ~
$ wget "http://downloads.sourceforge.net/project/wxpython/wxPython/2.9.4.0/wxPython-src-2.9.4.0.tar.bz2"
$ wget "http://downloads.sourceforge.net/project/wxpython/wxPython/2.9.4.0/wxPython-src-2.9.4.1.patch"
$ tar xvjf wxPython-src-2.9.4.0.tar.bz2
$ patch -p 0 -d wxPython-src-2.9.4.0/ < wxPython-src-2.9.4.1.patch
$ mkdir wxPython-src-2.9.4.0/bld

3. 再安裝相依的套件
$ sudo apt-get install dpkg-dev build-essential swig python-dev libwebkit-dev libjpeg-dev libtiff-dev checkinstall freeglut3 freeglut3-dev libgtk2.0-dev libsdl1.2-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libgconf2-dev libglapi-mesa libosmesa6 libglu1-mesa-dev libglu1-mesa mesa-common-dev

4. 等非常非常久的編譯和安裝
$ cd wxPython-src-2.9.0.1/wxPython
$ python build-wxpython.py --build_dir=../bld --install

5. 確認版本
$ python -V

6. 複製需要的library
$ sudo cp /usr/local/lib/libwx_* /usr/lib

7. 測試
$ python demo/demo.py

reference: Building and installing wxPython 2.9.4.0 on Raspberry Pi (Raspbian)

2013年9月22日 星期日

[RPi] Raspberry Pi : The Unofficial Tutorial

一篇還不錯的tutorial, 剛好有些東西是我正在找的