觀看記憶體
free -m
硬碟空間
df -h
mount -t tmpfs -o size=2G tmpfs /tmp/
格式化硬碟
指令為 mkfs -t ext4 /dev/sdc1
看cpu
cat /proc/cpuinfo|grep "model name"
更改系統時間
sudo date -s 2015/06/03
sudo date -s 14:00:00
sudo hwclock --systohc --utc
2014年12月25日 星期四
2014年10月17日 星期五
[android] adb shell 送 intent
ex:
adb shell am broadcast -a android.intent.action.xxx.xxx --ez state true
ON:
settings put global airplane_mode_on 1
am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
OFF:
settings put global airplane_mode_on 0
am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
am broadcast [--user <USER_ID> | all | current] <INTENT>
am broadcast: send a broadcast Intent. Options are:
--user <USER_ID> | all | current: Specify which user to send to; if not
specified then send to all users.
--receiver-permission <PERMISSION>: Require receiver to hold permission.
<INTENT> specifications include these flags and arguments:
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--esn <EXTRA_KEY> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]
[--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]
[--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]
[--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>]
[--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]
[--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]
[--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]
[-n <COMPONENT>] [-f <FLAGS>]
[--grant-read-uri-permission] [--grant-write-uri-permission]
[--debug-log-resolution] [--exclude-stopped-packages]
[--include-stopped-packages]
[--activity-brought-to-front] [--activity-clear-top]
[--activity-clear-when-task-reset] [--activity-exclude-from-recents]
[--activity-launched-from-history] [--activity-multiple-task]
[--activity-no-animation] [--activity-no-history]
[--activity-no-user-action] [--activity-previous-is-top]
[--activity-reorder-to-front] [--activity-reset-task-if-needed]
[--activity-single-top] [--activity-clear-task]
[--activity-task-on-home]
[--receiver-registered-only] [--receiver-replace-pending]
[--selector]
[<URI> | <PACKAGE> | <COMPONENT>]
2014年10月15日 星期三
[ubuntu] VIM 用法
選取
v 小寫
選取後可用以下方式操作:
d 刪除選取區內容。
y 複製選取區內容。
/etc/vim/vimrc
插入space取代Tab
:set expandtab
Tab = 4 space
:set tabstop=4
程式縮排需要space的個數
:set shiftwidth=4
:w 令存新檔
v 小寫
選取後可用以下方式操作:
d 刪除選取區內容。
y 複製選取區內容。
/etc/vim/vimrc
插入space取代Tab
:set expandtab
Tab = 4 space
:set tabstop=4
程式縮排需要space的個數
:set shiftwidth=4
:w 令存新檔
[ubuntu] Byobu
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
F6 - Detach from this session
F7 - Enter copy/scrollback mode
F8 - Re-title a window
F9 - Configuration Menu
F12 - Lock this terminal
alt + page up 往上捲動視窗
alt + page down 往下捲動視窗
Q: Putty 中使用Byobu F2~F4無效
Ans: "Terminal" -> "Keyboard" -> "The Function keys and keypad" 選用 "Xterm R6" 便可。
F3 - Move to previous window
F4 - Move to next window
F6 - Detach from this session
F7 - Enter copy/scrollback mode
F8 - Re-title a window
F9 - Configuration Menu
F12 - Lock this terminal
alt + page up 往上捲動視窗
alt + page down 往下捲動視窗
Q: Putty 中使用Byobu F2~F4無效
Ans: "Terminal" -> "Keyboard" -> "The Function keys and keypad" 選用 "Xterm R6" 便可。
2014年10月14日 星期二
[android] build android error
Case 1:
error while loading shared libraries: libz.so.1: cannot open shared object file 安裝
Case 2:
安裝
Case 3:
out/xxxxxx/host/linux-x86/bin/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory make: *** [out/xxxxxx/target/product/msm8226/obj/APPS/BackupRestoreConfirmation_intermediates/package.apk] Error 127 make: *** Deleting file `out/xxxxxx/target/product/msm8226/obj/APPS/BackupRestoreConfirmation_intermediates/package.apk' out/xxxxxx/host/linux-x86/bin/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory make: *** Waiting for unfinished jobs.... make: *** [out/xxxxxx/target/product/msm8226/obj/APPS/CalendarProvider_intermediates/package.apk] Error 127 make: *** Deleting file `out/xxxxxx/target/product/msm8226/obj/APPS/CalendarProvider_intermedackage.apk] Error 127 make: *** Deleting file `out/xxxxxx/target/product/msm8226/obj/APPS/DefaultContainerService_intermediates/package.apk' out/xxxxxx/host/linux-x86/bin/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory make: *** [out/xxxxxx/target/product/msm8226/obj/APPS/DownloadProvider_intermediates/package.apk] Error 127 make: *** Deleting file `out/xxxxxx/target/product/msm8226/obj/APPS/DownloadProvider_intermediates/package.apk' ******** Android build FAILED ********
error while loading shared libraries: libz.so.1: cannot open shared object file 安裝
$ sudo apt-get install lib32z1 正在讀取套件清單... 完成 正在重建相依關係 正在讀取狀態資料... 完成 下列【新】套件將會被安裝: lib32z1 升級 0 個,新安裝 1 個,移除 0 個,有 1 個未被升級。 需要下載 57.5 kB 的套件檔。 此操作完成之後,會多佔用 178 kB 的磁碟空間。 下載:1 http://tw.archive.ubuntu.com/ubuntu/ trusty/main lib32z1 amd64 1:1.2.8.dfsg-1ubuntu1 [57.5 kB] 取得 57.5 kB 用了 0s (176 kB/s) 選取了原先未選的套件 lib32z1。 (讀取資料庫 ... 目前共安裝了 214592 個檔案和目錄。) Preparing to unpack .../lib32z1_1%3a1.2.8.dfsg-1ubuntu1_amd64.deb ... Unpacking lib32z1 (1:1.2.8.dfsg-1ubuntu1) ... 設定 lib32z1 (1:1.2.8.dfsg-1ubuntu1) ... Processing triggers for libc-bin (2.19-0ubuntu6.3) ...
Case 2:
host C++: aidl <= frameworks/base/tools/aidl/generate_java.cpp host C++: aidl <= frameworks/base/tools/aidl/generate_java_binder.cpp host C++: aidl <= frameworks/base/tools/aidl/generate_java_rpc.cpp host C++: aidl <= out/xxxxxx/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp out/xxxxxx/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp: In function 'int yyparse()': out/xxxxxx/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:1947:30: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] out/xxxxxx/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:2091:30: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] Export includes file: frameworks/base/tools/aidl/Android.mk -- out/xxxxxx/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/export_includes Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l Notice file: frameworks/base/tools/aidl/NOTICE -- out/xxxxxx/host/linux-x86/obj/NOTICE_FILES/src//bin/aidl.txt /bin/bash: flex: command not found make: *** [out/xxxxxx/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127 make: *** Waiting for unfinished jobs.... Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. ******** Android build FAILED ********
安裝
sudo apt-get install flex
Case 3:
sudo apt-get install libxml2-utils
[ubuntu] 安裝Java 6
安裝 JDK 6
下載網址
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html
安裝
設定使用版本
檢查版本
下載網址
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html
$ chmod +x jdk-6u26-linux-x64.bin $ ./jdk-6u32-linux-x64.bin $ sudo mkdir -p /usr/lib/jvm $ sudo mv jdk1.6.0_26 /usr/lib/jvm/
安裝
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_26/bin/javac 1 $ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_26/bin/java 1
設定使用版本
$ sudo update-alternatives --config javac $ sudo update-alternatives --config java
檢查版本
$ java -version
2014年10月9日 星期四
[ubuntu] 安裝Samba
安裝samba # sudo apt-get install samba 修改設定 # vi /etc/samba/smb.conf [workspaces] comment = workspaces path = /home/aa/workspaces/ browseable = yes read only = no create mask = 774 valid users = aa admin users = aa 重啟 # sudo /etc/init.d/samba restart 新增帳號 # sudo smbpasswd -a xxxx
[ubuntu] ssh 安裝
安裝ssh # apt-get install ssh # apt-get install openssh-server 修改設定 # vim /etc/ssh/sshd_config Port 22 PasswordAuthentication yes 重啟 # /etc/init.d/ssh restart
[ubuntu] apt-get
設定proxy # /etc/apt/apt.conf Acquire::http::Proxy "http://user:password@xxx.xxx.xxx.xxx:80"; source 清單 # /etc/apt/sources.list
[ubuntu] grep 用法
grep --help
用法: grep [選項]... 樣板 [檔案]...
Search for PATTERN in each FILE or standard input.
PATTERN is, by default, a basic regular expression (BRE).
Example: grep -i 'hello world' menu.h main.c
Regexp selection and interpretation:
-E, --extended-regexp PATTERN is an extended regular expression (ERE)
-F, --fixed-strings PATTERN is a set of newline-separated fixed strings
-G, --basic-regexp PATTERN is a basic regular expression (BRE)
-P, --perl-regexp PATTERN is a Perl regular expression
-e, --regexp=PATTERN use PATTERN for matching
-f, --file=FILE obtain PATTERN from FILE
-i, --ignore-case ignore case distinctions
-w, --word-regexp force PATTERN to match only whole words
-x, --line-regexp force PATTERN to match only whole lines
-z, --null-data a data line ends in 0 byte, not newline
Miscellaneous:
-s, --no-messages suppress error messages
-v, --invert-match select non-matching lines
-V, --version print version information and exit
--help display this help and exit
--mmap ignored for backwards compatibility
Output control:
-m, --max-count=NUM stop after NUM matches
-b, --byte-offset print the byte offset with output lines
-n, --line-number print line number with output lines
--line-buffered flush output on every line
-H, --with-filename print the filename for each match
-h, --no-filename suppress the prefixing filename on output
--label=LABEL print LABEL as filename for standard input
-o, --only-matching show only the part of a line matching PATTERN
-q, --quiet, --silent suppress all normal output
--binary-files=TYPE assume that binary files are TYPE;
TYPE is `binary', `text', or `without-match'
-a, --text equivalent to --binary-files=text
-I equivalent to --binary-files=without-match
-d, --directories=ACTION how to handle directories;
ACTION is `read', `recurse', or `skip'
-D, --devices=ACTION how to handle devices, FIFOs and sockets;
ACTION is `read' or `skip'
-R, -r, --recursive equivalent to --directories=recurse
--include=FILE_PATTERN search only files that match FILE_PATTERN
--exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN
--exclude-from=FILE skip files matching any file pattern from FILE
--exclude-dir=PATTERN directories that match PATTERN will be skipped.
-L, --files-without-match print only names of FILEs containing no match
-l, --files-with-matches print only names of FILEs containing matches
-c, --count print only a count of matching lines per FILE
-T, --initial-tab make tabs line up (if needed)
-Z, --null print 0 byte after FILE name
Context control:
-B, --before-context=NUM print NUM lines of leading context
-A, --after-context=NUM print NUM lines of trailing context
-C, --context=NUM print NUM lines of output context
-NUM same as --context=NUM
--color[=WHEN],
--colour[=WHEN] use markers to highlight the matching strings;
WHEN is `always', `never', or `auto'
-U, --binary do not strip CR characters at EOL (MSDOS)
-u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)
`egrep' means `grep -E'. `fgrep' means `grep -F'.
Direct invocation as either `egrep' or `fgrep' is deprecated.
With no FILE, or when FILE is -, read standard input. If less than two FILEs
are given, assume -h. Exit status is 0 if any line was selected, 1 otherwise;
if any error occurs and -q was not given, the exit status is 2.
Report bugs to: bug-grep@gnu.org
GNU Grep home page: <http://www.gnu.org/software/grep/>
General help using GNU software: <http://www.gnu.org/gethelp/>
用法: grep [選項]... 樣板 [檔案]...
Search for PATTERN in each FILE or standard input.
PATTERN is, by default, a basic regular expression (BRE).
Example: grep -i 'hello world' menu.h main.c
Regexp selection and interpretation:
-E, --extended-regexp PATTERN is an extended regular expression (ERE)
-F, --fixed-strings PATTERN is a set of newline-separated fixed strings
-G, --basic-regexp PATTERN is a basic regular expression (BRE)
-P, --perl-regexp PATTERN is a Perl regular expression
-e, --regexp=PATTERN use PATTERN for matching
-f, --file=FILE obtain PATTERN from FILE
-i, --ignore-case ignore case distinctions
-w, --word-regexp force PATTERN to match only whole words
-x, --line-regexp force PATTERN to match only whole lines
-z, --null-data a data line ends in 0 byte, not newline
Miscellaneous:
-s, --no-messages suppress error messages
-v, --invert-match select non-matching lines
-V, --version print version information and exit
--help display this help and exit
--mmap ignored for backwards compatibility
Output control:
-m, --max-count=NUM stop after NUM matches
-b, --byte-offset print the byte offset with output lines
-n, --line-number print line number with output lines
--line-buffered flush output on every line
-H, --with-filename print the filename for each match
-h, --no-filename suppress the prefixing filename on output
--label=LABEL print LABEL as filename for standard input
-o, --only-matching show only the part of a line matching PATTERN
-q, --quiet, --silent suppress all normal output
--binary-files=TYPE assume that binary files are TYPE;
TYPE is `binary', `text', or `without-match'
-a, --text equivalent to --binary-files=text
-I equivalent to --binary-files=without-match
-d, --directories=ACTION how to handle directories;
ACTION is `read', `recurse', or `skip'
-D, --devices=ACTION how to handle devices, FIFOs and sockets;
ACTION is `read' or `skip'
-R, -r, --recursive equivalent to --directories=recurse
--include=FILE_PATTERN search only files that match FILE_PATTERN
--exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN
--exclude-from=FILE skip files matching any file pattern from FILE
--exclude-dir=PATTERN directories that match PATTERN will be skipped.
-L, --files-without-match print only names of FILEs containing no match
-l, --files-with-matches print only names of FILEs containing matches
-c, --count print only a count of matching lines per FILE
-T, --initial-tab make tabs line up (if needed)
-Z, --null print 0 byte after FILE name
Context control:
-B, --before-context=NUM print NUM lines of leading context
-A, --after-context=NUM print NUM lines of trailing context
-C, --context=NUM print NUM lines of output context
-NUM same as --context=NUM
--color[=WHEN],
--colour[=WHEN] use markers to highlight the matching strings;
WHEN is `always', `never', or `auto'
-U, --binary do not strip CR characters at EOL (MSDOS)
-u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)
`egrep' means `grep -E'. `fgrep' means `grep -F'.
Direct invocation as either `egrep' or `fgrep' is deprecated.
With no FILE, or when FILE is -, read standard input. If less than two FILEs
are given, assume -h. Exit status is 0 if any line was selected, 1 otherwise;
if any error occurs and -q was not given, the exit status is 2.
Report bugs to: bug-grep@gnu.org
GNU Grep home page: <http://www.gnu.org/software/grep/>
General help using GNU software: <http://www.gnu.org/gethelp/>
[ubuntu] find 指令
find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression] -name 檔名 ex. find . -name "*.php" -i 不區分大小寫 ex. find . -iname "*.php" -not ex. find . -not -name "*.php" -type f 檔案 ex. find -type f -iname "*gsm*" d 目錄 ex. find -type d -iname "*gsm*"
2014年10月3日 星期五
2014年9月27日 星期六
[android] 開啟Debug log
private static final String TAG = "LocationManagerService"; public static final boolean D = Log.isLoggable(TAG, Log.DEBUG);
透過adb 開啟
adb shell setprop log.tag.LocationManagerService DEBUG
[android] 開啟圖檔
private Bitmap openPic(String file) { if (file == null) return null; if (DEB_PIC) Log.d(TAG,"openPic() file = " + file); File f = new File(file); if (f.exists()) { return BitmapFactory.decodeFile(file); } else { Log.d(TAG,"openPic() "+ file+" not exists"); return null; } }
[android] 轉存png檔
private void savePic(Bitmap b,String strFileName) { //Log.e(TAG, "savePic()"); FileOutputStream fos = null; try { fos = new FileOutputStream(strFileName); if (null != fos) { b.compress(Bitmap.CompressFormat.PNG, 90, fos); fos.flush(); fos.close(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
[android] 抓螢幕截圖 java code
private void getPic() { Bitmap mScreenBitmap; Matrix mDisplayMatrix; mDisplayMatrix = new Matrix(); DisplayMetrics metrics = new DisplayMetrics(); WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE); if (wm == null) { Log.d(TAG,"getPic() wm = null"); return; } wm.getDefaultDisplay().getRealMetrics(metrics); float[] dims = {metrics.widthPixels, metrics.heightPixels}; float degrees = getDegreesForRotation(wm.getDefaultDisplay().getRotation()); boolean requiresRotation = (degrees > 0); if (requiresRotation) { // Get the dimensions of the device in its native orientation mDisplayMatrix.reset(); mDisplayMatrix.preRotate(-degrees); mDisplayMatrix.mapPoints(dims); dims[0] = Math.abs(dims[0]); dims[1] = Math.abs(dims[1]); } mScreenBitmap = SurfaceControl.screenshot((int) dims[0], (int) dims[1]); if (mScreenBitmap == null) { Log.d(TAG,"getPic() mScreenBitmap = null"); return; } if (requiresRotation) { // Rotate the screenshot to the current orientation Bitmap ss = Bitmap.createBitmap(metrics.widthPixels, metrics.heightPixels, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(ss); c.translate(ss.getWidth() / 2, ss.getHeight() / 2); c.rotate(degrees); c.translate(-dims[0] / 2, -dims[1] / 2); c.drawBitmap(mScreenBitmap, 0, 0, null); c.setBitmap(null); // Recycle the previous bitmap mScreenBitmap.recycle(); mScreenBitmap = ss; } // Optimizations mScreenBitmap.setHasAlpha(false); mScreenBitmap.prepareToDraw(); }
[android] 抓top activity 名稱
private String getTopActivity() { ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); if (am == null) { Log.d(TAG,"Go() am = null"); return null; } // get the info from the currently running task List< ActivityManager.RunningTaskInfo > taskInfo = am.getRunningTasks(1); //Log.d("topActivity", "CURRENT Activity ::" // + taskInfo.get(0).topActivity.getClassName()); ComponentName componentInfo = taskInfo.get(0).topActivity; //Log.d(TAG, "getPackageName = " + componentInfo.getPackageName()); return componentInfo.getPackageName(); }
[android] java code 送touch event
private void touch(int x, int y) { try { Runtime.getRuntime().exec("input tap "+x+" "+y); } catch (Throwable t) { } }
[android] service 處理音量鍵
android service 收不到key event.
可以透過 AUDIO_SERVICE
可以透過 AUDIO_SERVICE
public class SettingsContentObserver extends ContentObserver { int previousVolume; Context context; public SettingsContentObserver(Context c, Handler handler) { super(handler); Log.d(TAG,"SettingsContentObserver()"); context=c; AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); previousVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC); } @Override public boolean deliverSelfNotifications() { Log.d(TAG,"deliverSelfNotifications()"); return super.deliverSelfNotifications(); } @Override public void onChange(boolean selfChange) { Log.d(TAG,"onChange()"); super.onChange(selfChange); AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); int currentVolume = audio.getStreamVolume(AudioManager.STREAM_SYSTEM); Log.d(TAG,"onChange() currentVolume = "+currentVolume); } } } @Override public void onCreate() { super.onCreate(); Log.i(TAG, "onCreate()"); mSettingsContentObserver = new SettingsContentObserver(this,new Handler()); getContentResolver().registerContentObserver(android.provider.Settings.System.CONTENT_URI, true, mSettingsContentObserver ); } @Override public void onDestroy() { Log.d(TAG,"onDestroy()"); getContentResolver().unregisterContentObserver(mSettingsContentObserver); }
[android] 關於android 手機遊戲外掛
一點小小的想法!
經過實作確定可行!
python + adb command 實作andorid 手機的遊戲外掛
透過python 下adb command 截圖並pull 到電腦端
接著透過 python PIL lib 做圖形識別
接著對手機送touch event
優點:
實作超快! 省時省力
缺點:
需要開著電腦!
經過實作確定可行!
python + adb command 實作andorid 手機的遊戲外掛
透過python 下adb command 截圖並pull 到電腦端
def getPic(): os.chdir(adb) os.system("adb shell screencap -p /sdcard/screen.png") os.system("adb pull /sdcard/screen.png "+pic_dir+"pic.png") os.system("adb shell rm /sdcard/screen.png")
接著透過 python PIL lib 做圖形識別
接著對手機送touch event
def touch(x,y): os.chdir(adb) os.system("adb shell input tap "+str(x)+" "+str(y))
優點:
實作超快! 省時省力
缺點:
需要開著電腦!
2014年9月26日 星期五
[程式語言] syntaxhighlighter
syntaxhighlighter
可讓程式碼變得更好看
官網: http://alexgorbatchev.com/SyntaxHighlighter/
安裝方式 參考
http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html
程式碼用下面語法包起來
可讓程式碼變得更好看
官網: http://alexgorbatchev.com/SyntaxHighlighter/
安裝方式 參考
http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html
Brush name
|
Brush aliases
|
File name
|
bash, shell
|
shBrushBash.js
| |
cpp, c
|
shBrushCpp.js
| |
css
|
shBrushCss.js
| |
js, jscript, javascript
|
shBrushJScript.js
| |
java
|
shBrushJava.js
| |
perl, pl
|
shBrushPerl.js
| |
php
|
shBrushPhp.js
| |
py, python
|
shBrushPython.js
| |
xml, xhtml, xslt, html, xhtml
|
shBrushXml.js
|
程式碼用下面語法包起來
<pre class=
"brush: java"
>
</pre
"
>
public class Hello { public static int gvar; public static void say(String s) { int x = 10; System.out.print(s+x); } public static void main(String[] argv) { float y = 0; say("Hello, world\n"); } }
<pre class=
"brush: python"
>
</pre
"
>
print("Hello, world!")
2014年7月15日 星期二
2014年7月12日 星期六
[求婚] 關於求婚看板
關於求婚~~~
腦海中一直有一些想法, 想要做一些特別的東西.
翻翻過去的筆記對於單晶片一直很想要玩玩
用一個單晶片 控制LED燈 排成字的形狀~~ 順便求婚!!!
Good idea!!! 於是求婚看板就產生了!
小弟我念資工的會寫一點程式.
對於硬體的電子相關知識有點薄弱.
只好請教google 大師用最基本的東西做出這看板~~
在電路方面真的是土炮搞定他 線路很醜~~
我是寫SW的HW, 只是有時候我也會動手做一下 HW.
====== 製作篇 =======
2014.01.14
上網找了好久看到這東西!
Arduino Leonardo 單晶片開發版. 光看到李奧納多 名字就贏了
對於我這軟體工程師來說 寫C code 這個簡單
他有多個 IO (5V) 可以控制LED 字型
而且也很便宜. 就決定是他了.
因為板子上IO 是 5V, LED電路打算用12V
就入手了一個8路繼電器
2014.01.28
關於LED, 在台灣一顆要價1~3元不等. 做看板保守估計要三四百棵LED
加上預留實作失敗的部分, 看來這筆開銷很可觀!
在掏寶發現超便宜~~~
所以一次買了三包 白 藍 紅~~ 各 1000顆!!!!
平均一包 2XX 台幣. 只能說台灣賣真貴!!!
2014_02_01
開始擬草稿刻字~~~ 美工時間!!!
阿母表示: 你不是要求婚! 應該要寫 佳圓嫁給我~~~
HW: 對ㄟ! 可惡! 那個字很難刻ㄟ 要砍掉重練了!!!
2014_02_15
努力刻字中~~~
排版中~~
最後拍板定案! 就這個!
2014_02_16
因為我超懶惰! 直接用焊槍打洞!! 超臭~~~
有個雛形了~~~
2014_02_27 求婚看版
努力焊接中~~~ 焊槍! 電表 鉗子 熱熔膠~~ 好忙! 好忙! 眼睛好花!
試點燈~~~ 成功!!!
焊了兩三周!!! 終於~~ 完成四個字!
不得不說! 這LED 超亮~~~
2014_03_08 求婚看板
最後一個 "嫁" 字! 努力中~~
安裝繼電器!!!
試點燈!!! 測試OK!
2014_03_15 求婚看版
今日目標:
接上 Arduino Leonardo 開發版.
測試OK! 可以透過寫程式 經由單晶片 控制 板子的亮暗!!! 閃爍!
看板閃爍過於頻繁繼電器似乎被我搞壞
一直秀逗不知道是不是磁化. 還是不能這樣搞!
只好放棄閃爍了~~~~
另外! 電源打開後他就開始閃爍感覺就很單調遜遜的!
為了要能隨心所欲控制看板燈光
所以這裡在板子上接一個紅外線接收器.
拿沒有再用的遙控器來遙控看板!
完工!!!
2014_07_05 求婚看板
首先有人會問為什麼四個月沒動工!
答案: 因為想說還沒要求婚! 完成度也很高了~~~
因為拿到婚戒了! 也該求婚了~~ 所以開始動工!
可惡! 放太久 上面有一層灰塵!!! 哈!!!
電路板固定好了! 遙控的程式也寫好了~~~
另外多接一個USB 接頭吃單晶片開發版的電
接 USB抬燈 ~~~ 透過遙控器 讓他閃爍!!!
求婚時! 只要插上電源! 拿著遙控器 就OK了!!!!
測試OK!!!
用了四百多顆LED終於~~~ 完工!!!
2014.07.11
算算拿到婚戒到現在. 完完全全沒有機會去高雄!
本想要請女友的好姊妹一起幫忙求婚!
人算不如天算! 完全沒有時間! 只好全部自己來~~
在全黑的房間! 看板散發出藍光~~~
我盡力了! 單眼完全拍不出那個感覺!!!
用錄影的也錄不出來~~~
現場看到是清晰 耀眼的字! 還有周圍藍藍的光線!!!
燈光美! 氣氛佳~~~
在測試的時候拍到的!!!
看板燈光打到人身上就是這感覺~~~
女友最愛的藍色!!!
求婚看板 + 玫瑰花束 + 求婚影片 + 鑽戒!
終於~~~ Yes, I do.
2014年5月26日 星期一
[旅遊] 2014_05_26 頭前溪
來新竹多年~ 第一次朝聖!
近年來熱門的拍照景點, 其實離竹科不遠下班背著相機過去就可以了
六點多到已經滿滿的腳架下次要早點去!
心得:必備拖鞋涉水可以取得比較好的拍照角度.
地點:竹美路二段往68快速到路走到底右轉
遇到下面的插路穿過68快速道路即可看到
2014年5月14日 星期三
訂閱:
文章 (Atom)