Thursday, April 17, 2014
在營天數破百?
日子一天天過去也到了這時候,倒數退伍的日子也來到了四個月多一點,對於過去的日子我沒有太深刻的印象做過些甚麼,大概就是站哨背背英文單字混日子,努力後悔已經過往的大學生活而後緊追即將逝去的青春尾巴,我不求在軍旅生涯留下些珍貴記憶,那是可遇而不可求的,在當兵的日子裡我覺醒到之前大學十多摸揮霍,只求能用空閒時間多吸收點知識為茫茫然的未來多點準備,也就夠了
長官常為了安撫我們的心理不平衡而編些小故事大道理,說軍隊生活是難得可貴的經驗,基本教練不僅雕塑體態也能即時發現瘠錐側彎云云,讓人忍不住白眼上翻,再加上個國家扛住的中視莒光園地小資製作的單元短片,快速的場景切換與二流演員爛演技所鋪陳出的爛劇情,心理尷尬死了.
剛到新環境的我總會試圖擴展人際關係,若有似無的設定好大概的相處模式後,就慢慢淺沉了,越來越少的互動甚至見了面也是簡單打招呼帶過,大部分時候是真的找不到適合的話題,偶爾是覺得太刻意的談話太過多餘,到底,我也是個孤僻的人?誰知道呢?也許是太過懶散不想跨出範圍為兩坪大床舖的舒適圈罷了?其實弟兄們人都還不錯,各有各個有趣故事,只是常常自我感覺不好怕融入不進去,擔心自己話不得體卻又想塑造出幽默風趣的形象,想討論愛情與浪漫卻過於有所保留故事或作太過情色的細節描述,總是能永很多種複雜的手法透過第三人稱手法剖析自己的行為,卻不能簡簡單單的與人快樂交談,悶
Sunday, March 16, 2014
第一個shell script,批次用megadl下載MEGA免費空間資源
切換到全linux的作業環境後,很多應用程式都能找到替代方案,唯獨論壇上免空資源的 下載器,大多是為了廣大的windows用戶所撰寫,自己常下載的免空大老"MEGA"就是其中 一例,windows上可以利用MegaDownloader自動排程下載,linux下目前只有看到Megatools 這套cml界面的工具可用,而且裡面只有一個cmd是用來下載他人分享的內容,其餘都是用 來對自己的空間坐上傳,下載,查詢等等,與原來windows下的MegaDownloader功能相去甚遠。
Megatools裡頭用來下載remote file的manual大致如下:megals(1) megatools manual megals(1)
name
megadl - download exported files and directories from mega.co.nz
synopsis
megadl [--no-progress] [--path <path>] <links>...
megadl --path - <filelink>
description
downloads exported files and folders from mega.co.nz. handles links like:
· https://mega.co.nz/#!7yvwhczz!baublakkkvv8him-8-qfmgoys289toqwn7rgfpzxb_w
· https://mega.co.nz/#f!hilfdajt!hlivvqqkse1d0ogxzuaojg
when downloading individual files, these are placed into <path>. when downloading folders, the contents of the folder are placed into directory
specified by <path>.
to export files, you can use mega.co.nz web application, or megals(1)'s --export option.
options
--path <path>
local directory to download to. defaults to the current working directory.
if <path> is -, remote file will be streamed to stdout.
--no-progress
disable download progress reporting. this is implied when streaming.
--debug [<options>]
Enable debugging of various aspects of the megatools operation. You may enable multiple debugging options separated by commas. (eg. --debug
api,fs)
Available options are:
· api: Dump Mega.co.nz API calls
· fs: Dump Mega.co.nz filesystem (may require --reload to actually print something)
· cache: Dump cache contents
--version
Show version information
<links>
File and folder links to download from.
<filelink>
Link to exported file to stream.
例如要下載一個連結為 https://mega.co.nz/#!7YVWhCzZ!bauBlAkKKvv8hIm-8-qFmGOYS289ToQWN7rGFPzXB_wf的檔案 megadl 'https://mega.co.nz/#!7YVWhCzZ!bauBlAkKKvv8hIm-8-qFmGOYS289ToQWN7rGFPzXB_w'
如果我有一連串的連結我就要手動作N次,很沒效率 剛好最近有接觸到shell script,就用他來批次化完成吧 先看code:
#! /bin/bash
cd /media/G;
filename="$1";
passcode="$2";
scriptname=${filename%.*}.sh;
cat $filename | sed 's/^/megadl /' | awk -v q="'" '{print $1 " " q$2q }' >$scriptname;
echo "$scriptname" be created;
sh $scriptname;
echo Download finish remove "$scriptname";
rm $scriptname;
Thursday, March 6, 2014
VIM autocmd 功能
These day are heading for blogger template,try to make my own blogger be more attractive : ). To do that i download template( it's xml format ) pondering how it work line-by-line. As i am learning vim, i use vim to edit it, weel, it really impresive me with it's powerful cursor movement, but it's not enouth for me, the code in downloaded template expand all over, it's hard to view and so does to edit, SO i start to learn about vim's autocmd function
These day are heading for blogger template,try to make my own blogger be more attractive : ). To do that i download template( it's xml format ) pondering how it work line-by-line. As i am learning vim, i use vim to edit it, weel, it really impresive me with it's powerful cursor movement, but it's not enouth for me, the code in downloaded template expand all over, it's hard to view and so does to edit, SO i start to learn about vim's autocmd function
autocmd let vim be able to execute speicific command automatically when reading or writting a file
definition of autocmd
:au[tocmd] [group] {event} {pat} [nested] {cmd}
execute automatically on {event} for a file matching
{pat} |autocmd-patterns|. Vim always adds the {cmd} after existing autocommands,
so that the autocommands execute in the order in which
they were given.
Saturday, December 28, 2013
在Ubuntu上安裝Edimax usb adapter驅動
2013-12-28
昨天衝動的買了顆Micron Crucial M500 ,僅為了安裝Ubuntu,想嘗試看看完全擺脫M$,會有這樣的想法是前陣學習Ubunut無力時看到《完全用Linux工作》,剛好這陣子頗有時間,Let's do it!簡單備份過資料,開始擔心裝置的driver問題,以往安裝完Windows後還需要安裝chipset、網卡、graphical card等的driver,可以預想在Linux下應該需要設定更多細節,令我訝異的是安裝進行到一半時Ubuntu有抓到Edimax網卡,可是很不穩定,稍微查詢了一下,好像是Ubuntu會把一些chipset的driver編入kernel,但更新不如原廠頻繁,故對硬體來說僅是"堪用"而已。
我所使用的這顆Edimax EW-7811Un是使用RealTek 8188cus chipset,Ubuntu內建對應的driver有以下幾種:
- rtl8192cu
- rtl8192c_common
- rtlwifi
知道問題後解決步驟如下:
- 下載對應驅動
- 把原生驅動加入blacklist,使之無法載入
sudo gedit /etc/modprobe.d/blacklist.conf
並在檔案最後加上
# Blacklist native RealTek 8188CUs drivers
blacklist rtl8192cu
blacklist rtl8192c_common
blacklist rtlwifiThe blacklist command will blacklist a module so that it will not be loaded automatically, but the module may be loaded if another non-blacklisted module depends on it or if it is loaded manually.
However, there is a workaround for this behaviour; the install command instructs modprobe to run a custom command instead of inserting the module in the kernel as normal, so you can force the module to always fail loading - 解壓縮下載的驅動程式,開啟終端機切換到解壓後的目錄裡,裡頭應該會有一個,install.sh檔,執行:
sudo bash install.sh - log-out and log-in,收工!
Refence
Thursday, December 26, 2013
修改.bashrc,讓終端機更多色
2013-12-26
看不習慣bash shell預設全白的prompt,修改/etc/bash.bashrc把$PS1調成舒適的綠色- set /etc/bash.bashrc to change shell prompt
PS1="\e[1;32m[\u @ \A #\# \W]\$ \e[m "Reference:
1修改 .bashrc,让 Linux 文本界面显示颜色
2BASH Shell: Change The Color of My Shell Prompt Under Linux or UNIX
3Easy PS1 Colors
掛載Linux下未分配之磁碟空間
2013-12-26
前天把原本安裝雙系統(win7 & ubuntu12.04 LTS)的thinkpad x61重灌,想專心練習操作Linux,之前再用ubuntu存取win7或硬碟上剩餘空間時總會有些權限上的問題,故這次安裝時特別把磁區依照需求作調整,原本以為未分配的130G空間可以在安裝後直接使用,後來才發現用fdisk找不到,最後依照以下方法搞定:
- use gparted to create new partition with those unlocated space
Ubuntu 12.04 LTS 紀錄
2013-12-25
- install Ubuntu12.04 LTS

