2016年2月4日 星期四

Python 取相對路徑


Python取相對路徑的方式很簡單,以下三種。

第一種:(在檔案中取相對路徑方法)
import os
os.path.join(os.path.dirname(__file__), '** 這裡可以寫該位置下的資料夾 **')


第二種:(在命令列console中取相對路徑方法一)
import os, sys
os.path.join(os.path.dirname(sys.argv[0]), '** 這裡可以寫該位置下的資料夾 **')

第三種:(在命令列console中取得相對路徑方法二)
import os
os.path.join(os.path.dirname(os.getcwd()), '** 這裡可以寫該位置下的資料夾 **')


2015年12月1日 星期二

Ubuntu 14.04改成Mac 風格

※ 就只是Script而已,詳情請參考NoobsLab的這篇文章。

請把他複製貼上到您的script檔案裏面,有沒有副檔名不要緊。

程式碼如下:E.g.macstyle.sh...etc.
# -*- coding: utf-8 -*-
#/usr/bin/env bash
sudo add-apt-repository -y ppa:docky-core/ppa
sudo add-apt-repository -y ppa:noobslab/themes
sudo add-apt-repository -y ppa:noobslab/apps
sudo apt-get update
sudo apt-get install -y docky mac-ithemes-v3 mac-icons-v3 mbuntu-bscreen-v3 mbuntu-lightdm-v3 indicator-synapse ubuntu-tweak libreoffice-style-sifr unzip
cd && wget -O Mac.po http://drive.noobslab.com/data/Mac-14.04/change-name-on-panel/mac.po
cd /usr/share/locale/en/LC_MESSAGES
sudo msgfmt -o unity.mo ~/Mac.po;rm ~/Mac.po;cd
gsettings set com.canonical.desktop.interface scrollbar-mode normal
sudo xhost +SI:localuser:lightdm
sudo su lightdm -s /bin/bash
gsettings set com.canonical.unity-greeter draw-grid false;exit
sudo mv /usr/share/unity-greeter/logo.png /usr/share/unity-greeter/logo.png.backup
wget -O launcher_bfb.png http://drive.noobslab.com/data/Mac-14.04/launcher-logo/apple/launcher_bfb.png
sudo mv launcher_bfb.png /usr/share/unity/icons/
wget -O mac-fonts.zip http://drive.noobslab.com/data/Mac-14.04/macfonts.zip
sudo unzip mac-fonts.zip -d /usr/share/fonts; rm mac-fonts.zip
sudo fc-cache -f -v

2015年11月27日 星期五

下拉式滾動條 Scrollbar設定為Normal


下拉式滾動條 Scrollbar設定為Normal


程式碼如下,

gsettings set com.canonical.desktop.interface scrollbar-mode normal

2015年11月21日 星期六

Ubuntu .desktop檔案

Ubuntu .desktop檔案格式。


[Desktop Entry]
Version=1.0       /* 程式版本 */
Name=             /* 程式名稱 */
GenericName=      /* 程式通用名稱,可以跟名稱相同 */
Comment=          /* 程式相關的提示 */
Exec=             /* 程式本體位置 */
Icon=             /* 程式的圖示(icon) */
Type=             /* 程式類型 */
Terminal=         /* 預設為false,如果用true的話程式執行會出現terminal */
Categories=       /* 程式類別 */
StartupWMClass=   /* 預設程式名稱 */ 



參考網址:Desktop files: putting your application in the desktop menus

2015年10月20日 星期二

2015年8月16日 星期日

世紀帝國III密技

nova & orion
得到10000單位的經驗值

medium rare please
得到10000單位的食物

<censored>
得到10000單位的木頭

give me liberty or give me coin
得到10000單位的金子

trade plz
得到10000單位的出口收入

a whole lot of love
得到1000單位的所有資源

x marks the spot
去除戰爭迷霧

ya gotta make do with what ya got
生出一尊會射出野豬的大炮

where's that axe?
生出喬治‧「垮」盛頓

o canada 2005
生出一隻懶惰的熊

don't kick the pitbull
生出一隻利爾厲

wuv woo vol.2
生出一隻會飛的紫貘

wee ooh wee ooh
生出一台大安迪

ding ding ding
生出一台怪物冰淇淋卡車

mustard relish and burning oil
生出一台火焰熱狗推車

sooo good
打開「Musketeer』ed!」模式

speed always wins
快速建造100倍速。

this is too hard
直接勝利

tuck tuck tuck
四輪怪物卡車!

A recent study indicated that 100% of herdables are obese
養肥地圖上所有的動物~

2015年6月30日 星期二

Ubuntu Pypy 安裝教學!!

如何在Ubuntu 14.04上面安裝Pypy

只要輸入以下指令,即可在Ubuntu上面安裝並使用Pypy。

sudo add-apt-repository -y ppa:pypy/ppa
sudo apt-get update
sudo apt-get install -y pypy pypy-dev


開心的使用Pypy吧!!