2013年7月31日 星期三

[Mac] How to mount a smb share folder through terminal with AD account

之前剛轉換到Mac下時,嘗試直接使用Mac 去mount windows 下的share folder不過都沒成功過,後來才發現
原來是因為使用ad account的關係,原本以為就是一般用法 domain/username即可,不過後來發現其實應該在
domain後面接一個;(semi-colon),詳細的用法其實可以直接man mount_smbfs 即會提到,難怪都沒成功過
 
#!mount -t smbfs "//domain;username:password@host/share" /smbaudit

 

ps:如果密碼有含特殊字元,例如 ‘@‘ 請將他換成 ‘%40’    (URL encode)

可以使用類似的線上url encode/decode tool 去轉換   :http://meyerweb.com/eric/tools/dencoder/

2013年7月25日 星期四

How to mount an Mac AFP share on Raspberry Pi

1.Download a apt client from  http://sourceforge.net/projects/afpfs-ng

2.

sudo apt-get install libfuse-dev libreadline-dev
./configure --enable-gcrypt=/usr/lib
make
sudo make install
sudo ldcondig

3.檢查是否安裝成功

#!afp_client status

3.

#!mount command
 mount_afp 'afp://[username]:[password]@[ip address]/My Book Thunderbolt Duo'  '/mnt/mac/'

4.#!umount command

afp_client umount /mnt/mac

2013年7月24日 星期三

nc(net cat) as port forwardingg

1.nc

nc -k -l 192.168.1.21 45630 | nc 10.168.2.4 45631 -x

 

2.netcat

#將local port 45630 轉到遠端的45631 

#!netcat -p 45630 -L 10.168.2.4:45631 -vv

[Raspberry] emit server

1.libminiupnpc-dev

[Raspberry] How to install air video server on raspberry pi

1.安裝java: 請裝jdk8方可以在raspberry上沒問題的跑起來

https://jdk8.java.net/download.html

使用update-alternative替換系統java路徑

#!update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0/bin/java" 2
#!update-alternatives --set java /opt/java/jdk1.8.0/bin/java

2.安裝linux 版air video server

http://www.inmethod.com/forum/posts/list/5276.page

#在安裝mpeg4ip-server可能會遇到編譯上的問題,可以參照下列的文章,把問題逐步排除

http://jieyeh.blog.163.com/blog/static/8774559201322905932237/

列出所有user's crontab job

for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done

[deb] apt-get force resolved dependency issues

apt-get build-dep build-essential

[Raspberry Pi] sdl-config not found

sudo apt-get install gcc build-essential libsdl1.2-dev

[Raspberry pi] Install AirVideo server on Raspberry

http://www.inmethod.com/forum/posts/list/1856.page

http://wiki.birth-online.de/know-how/hardware/apple-iphone/airvideo-server-linux

2013年7月23日 星期二

[mac] Use disk to burn/restore image to sd card

##1.先從Mac Terminal 下面找出SD card的磁碟機代號,如果如下為/dev/disk1s1就先將他umount
sudo diskutil unmount /dev/disk1s1
##2.整個sd card的磁碟機代號應該為/dev/disk1 ,如果想要進行raw disk 直接燒錄,則把磁碟機代號前面+'r'變成
## /dev/rdisk1 ,這邊推薦直接使用rdisk燒錄,根據我的經驗,速度大概差了一倍
sudo dd if=2012-08-08-wheezy-armel.img of=/dev/disk1s bs=2m
##clone a partition
dd if=/dev/sda1 of=/dev/sdb1 bs=4096 conv=notrunc,noerror
 
##clone entile disk
dd if=/dev/sda of=/dev/sdb bs=4096 conv=notrunc,noerror

2013年7月22日 星期一

registrant vs registrar 差別

今天下載了一個陳年的dns-check script,發現有一些網站他都沒辦法正確解析,看了一下,他裡面是透過捉取registrar這個字眼當關鍵字,我就觀察了一下他沒辦法parse的檔案,裡頭幾乎都是屬於hosting 的domain name,裡面都沒registrar這個字眼,只有registrant,想說找看看他們差異到底是什麼,原來registrant屬於end user,就是實際的註冊者,registrar算是辦事員,幫忙申請管理的人,詳細的差異可以參考下列的pdf檔案

 

http://ws.edu.isoc.org/workshops/2004/ccTLD-bkk/day2/registration.pdf

2013年7月18日 星期四

非常好用的API 搜尋與管理文件 Dash

Dash 屬於一種API 文件搜尋管理與個人資料庫管理軟體,使用上個人覺得有下列幾項優點

1.豐富的API文件庫:c,c++,python,perl....

2.可以跟很多種軟體結合在一起,例如xcode, sublime都有相對應的套件,方便搜尋API 文件或你自己的個人程式碼資料庫

3.好用的snippet: 主要用法如下,可以把自己常用的(常常copy & paste)的程式,寫成一個snippet,取一個自己記得而且不重複的名稱,

當你在其他的editor中,打字時,就可以直接呼叫dash的快速鍵,他就會開啟dash search幫你找出對應的snippet,這時候按下use 他就會

根據snippet中程式碼你所設定的一些變數,當你需要使用時,可以動態的產生一些相對應的資料好讓你copy,目前dash snippet主要支援

  a.placeholder :顧名思義,就是讓你方便定位用的,在snippet中使用__xxxx__這樣,等轉換程式碼時,你就可以直接使用table當定位符號,加速修改工作

 b.@date:可以自行產生當時的時間

 

 

How to debug a Javascript proxy.pac

1.http://www.jslint.com/

2.http://code.google.com/p/pacparser/

3.http://www.proxypacfiles.com/proxypac/index.php?option=com_content&view=article&id=61&Itemid=102

2013年7月17日 星期三

segfault at ntop 3.3

原因為ntop 3.3的known issue,要解決這個方法就是升級安裝到3.4

1.apt-add-repository ppa:sylvain-garcia
2.apt-get update
3.apt-get install ntop
4.apt-get install rrdtool

   5.如果需要更改監聽的網卡,請修改init.cfg

vim /var/lib/ntop/init.cfg 

   6.啟動ntop -A 設定管理者密碼

  7. ntop 預設會綁訂再http://127.0.0.1:3000 port 如果像要使用https的話,請使用

  8.ntop -w 4223  (listen at https://127.0.0.1:4223)

  9.如果有遇到全縣問題(xx permission deny),請檢查檔案的owner 與權限 (/var/lib/ntop/xxxx)

How to enable syntaxhighter support with MarsEdit on google blogger

1.修改google blogger 上面,增加下列的線上syntaxhighter 再 </head>前找個地方貼上

a.請先參考附件中你所需要的highlight的程式碼,加入到google blogger中  ,例如要bash的支援,就找到"shBrushBash.js"

http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/

<!--SYNTAX HIGHLIGHTER BEGINS--> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'/>

<script language='javascript'> SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;; SyntaxHighlighter.all(); </script> <!--SYNTAX HIGHLIGHTER ENDS-->

 

2.MarsEdit

1.New post-

 =>Format ->Customize

按照語法,增加自定的format,例如增加下列為python code hightligh

2.NewImage

Hamichi+vnc+autodiscovery讓你的Mac隨時可以連結存取 Raspberry Pi

@Raspberry Pi

1.sudo apt-get install netatalk

2.sudo apt-get install avahi-daemon

3.sudo update-rc.d avahi-daemon defaults

4.sudo vi /etc/avahi/services/afpd.service

寫入下列檔案 <?xmlversion="1.0"standalone='no'?><!--*-nxml-*-->

<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
   <namereplace-wildcards="yes">%h</name>
   <service>
      <type>_afpovertcp._tcp</type>
      <port>548</port>
   </service>
</service-group>
 
 
5.sudo /etc/init.d/avahi-daemon restart
6.sudo apt-get install tightvncserver
7.vim /etc/init.d/tightvncserver
寫入下列檔案 (如果直接拷貝下列檔案,請注意"是否被系統轉換)
#!/bin/bash
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $remotefs $syslog
# Required-Stop: $remotefs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC server at boot time
# Description: Start VNC Server at boot time
### END INIT INFO
 
# The Username:Group that will run VNC
export USER=”pi”
#${RUNAS}
 
# The display that VNC will use
DISPLAY=”1″
 
# Color depth (between 8 and 32)
DEPTH=”16″
 
# The Desktop geometry to use.
#GEOMETRY=”x”
#GEOMETRY=”800×600″
#GEOMETRY=”1440×900″
#GEOMETRY=”1280×1024″
GEOMETRY=”1920×1080″
 
# The name that the VNC Desktop will have.
NAME=”my-vnc-server”
 
OPTIONS=”-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}”
 
. /lib/lsb/init-functions
 
case “$1″ in
start)
log_action_begin_msg “Starting vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
su ${USER} -c “/usr/bin/vncserver ${OPTIONS}”
;;
 
stop)
log_action_begin_msg “Stoping vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
su ${USER} -c “/usr/bin/vncserver -kill :${DISPLAY}”
;;
 
restart)
$0 stop
$0 start
;;
esac
 
exit 0
8.sudo chmod +x /etc/init.d/tightvncserver

9.sudo pkill Xtightvnc

10.sudo /etc/init.d/tightvncserver start

11.cd /etc/init.d

12.sudo update-rc.d tightvncserver defaults

13.sudo vim /etc/avahi/services/rfb.service
編寫下列內容 <?xmlversion="1.0"standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <namereplace-wildcards="yes">%h</name>
  <service>
    <type>_rfb._tcp</type>
    <port>5901</port>
  </service>
</service-group>
 
14.sudo /etc/init.d/avahi-daemon restart
 
#設定hamichi 個人vpn
從下列網址取的最新版的hamichi連結
**[2014/04/29 update] 最新版的hamachi 會遇到編譯上的問題 Illegal instraction
可以從下列的連結下載好心的網友提供的舊版 https://www.dropbox.com/s/b3qmefk60n7ng7v/logmein-hamachi-2.1.0.101-armel.tgz
 
https://secure.logmein.com/labs/#HamachiforLinux
15.wget https://secure.logmein.com/labs/logmein-hamachi_2.1.0.86-1_armel.deb
dpkg -i
logmein-hamachi_2.1.0.86-1_armel.deb
apt-get update
apt-get install --fix-missing lsb lsb-core
 
16.sudo hamachi login
17 sudo hamachi attach "your logmein.com email address
18.搞定
NewImage

How to restore a deleted onenote page

復原不小心誤刪的onenote