還是來做個筆記好了~ ^_^
每次開啟 irssi 時自動加入聊天室頻道
/log open -autoopen -freenode -targets #channel ~/irclogs/freenode/channel/%Y/%m/%d
記錄聊天室頻道的對話內容
/channel add -auto #channel freenode
參考 http://www.jeffhung.net/blog/articles/jeffhung/742/
GNU/Linux, Debian/Ubuntu, Mac OS X, Free Software/Open Source Software, Freeware, and Programming.
/log open -autoopen -freenode -targets #channel ~/irclogs/freenode/channel/%Y/%m/%d
/channel add -auto #channel freenode
function media_player ()
{
#totem $1
#mplayer $1
gst-launch playbin uri=$1
}
$ sudo aptitude install gstreamer-tools gstreamer0.10-plugins-base gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly gstreamer0.10-ffmpeg gstreamer0.10-alsa
# yum install gstreamer-tools gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg
sudo aptitude remove skype
sudo dpkg -i skype-debian_2.0.0.13-1_i386.deb
選中了曾被取消選擇的套件 skype。
(正在讀取資料庫 ... 系統目前總共安裝有 162814 個檔案和目錄。)
正在解壓縮 skype (從 skype-debian_2.0.0.13-1_i386.deb) ...
dpkg:相依關系問題使得 skype 的設定工作不能繼續:
skype 相依於 libqt4-core (>= 4.2.1)﹔然而:
套件“libqt4-core”沒有安裝。
skype 相依於 libqt4-gui (>= 4.2.1)﹔然而:
套件“libqt4-gui”沒有安裝。
dpkg:處理 skype (--install)時出錯:
相依關系問題 - 仍未被設定
在處理時有錯誤發生:
skype
sudo aptitude install
讀取套件清單中... 完成
了解套件依存關係中
Reading state information... 完成
Reading extended state information
Initializing package states... 完成
Building tag database... 完成
The following packages are BROKEN:
skype
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
The following packages have unmet dependencies:
skype: 依存關係: libqt4-core (>= 4.2.1) but it is not installable
依存關係: libqt4-gui (>= 4.2.1) but it is not installable
Resolving dependencies...
The following actions will resolve these dependencies:
Remove the following packages:
skype
Score is 121
Accept this solution? [Y/n/q/?] n
Resolving dependencies...
The following actions will resolve these dependencies:
Install the following packages:
libqt4-core [4.3.2-0ubuntu3.1 (gutsy-proposed, now)]
libqt4-gui [4.3.2-0ubuntu3.1 (gutsy-proposed, now)]
Leave the following dependencies unresolved:
libqt4-gui recommends qt4-qtconfig
Score is -168
Accept this solution? [Y/n/q/?] Y
Writing extended state information... 完成
選中了曾被取消選擇的套件 libqt4-core。
(正在讀取資料庫 ... 系統目前總共安裝有 162932 個檔案和目錄。)
正在解壓縮 libqt4-core (從 .../libqt4-core_4.3.2-0ubuntu3.1_i386.deb) ...
選中了曾被取消選擇的套件 libqt4-gui。
正在解壓縮 libqt4-gui (從 .../libqt4-gui_4.3.2-0ubuntu3.1_i386.deb) ...
正在設定 libqt4-core (4.3.2-0ubuntu3.1) ...
正在設定 libqt4-gui (4.3.2-0ubuntu3.1) ...
正在設定 skype (2.0.0.13-1) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
讀取套件清單中... 完成
了解套件依存關係中
Reading state information... 完成
Reading extended state information
Initializing package states... 完成
Tracker is an advanced framework for first class objects with associated metadata and tags. It provides a one stop solution for all metadata, tags, shared object databases, search tools and indexing.
Homepage: http://www.tracker-project.org
import java.io.*;
...
try {
Process p = Runtime.getRuntime().exec("ls");
String line;
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null)
System.out.println(line);
input.close();
} catch (IOException e) {
...
}
...
class HelloWorld
{
public native int[][] multiply(int A[][], int B[][]);
static
{
System.loadLibrary("HelloWorldImp");
}
public static void main(String[] args)
{
HelloWorld test = new HelloWorld();
int[][] A = new int[5][5];
int[][] B = new int[5][5];
int[][] result = test.multiply(A, B);
System.out.println(result[0][0]);
}
}
/* DO NOT EDIT THIS FILE - it is machine generated */
#ifndef __HelloWorld__
#define __HelloWorld__
#include
#ifdef __cplusplus
extern "C"
{
#endif
JNIEXPORT jobjectArray JNICALL Java_HelloWorld_multiply (JNIEnv *env, jobject, jobjectArray, jobjectArray);
#ifdef __cplusplus
}
#endif
#endif /* __HelloWorld__ */
#include "HelloWorld.h"
JNIEXPORT jobjectArray JNICALL Java_HelloWorld_multiply (JNIEnv *env, jobject obj, jobjectArray A, jobjectArray B);
{
jobjectArray C;
...
return C;
}
Never try to set the interface numbers so that they correspond to the release number of
your package. This is an abuse that only fosters misunderstanding of the purpose of library
versions. Instead, use the -release flag (see Release numbers), but be warned that every release
of your package will not be binary compatible with any other release.
#!/bin/sh
wmp_get()
{
wget -q --user-agent 'Windows Media Player' --referer=http://hichannel.hinet.net -O - $*
}
URL=$(wmp_get $(wmp_get http://hichannel.hinet.net/api/streamradio.jsp?id=177 | grep mms | cut -d '"' -f 2) | grep 203 | cut -d '"' -f 2)
mplayer $URL
$ sudo aptitude install build-essential dh-make devscripts fakeroot dpatch patch diff patchutils dpkg-dev這次目標的問題套件是 scim-chewing
$ apt-get source scim-chewing進入解開的scim-chewing-0.3.1目錄
$ dpatch-edit-patch 50_patch-from-fedora開始盡情的修改程式要離開時再執行 exit 就可以了
scim-chewing_0.3.1-1ubuntu5.diff.gz這樣應該就包好 deb 套件了... 不過 scim-chewing 在 ubuntu 7.04 上會讓 gnome-terminal 突然當掉關閉的問題還是沒有解掉啊~~~ XD
scim-chewing_0.3.1-1ubuntu5.dsc
scim-chewing_0.3.1-1ubuntu5_i386.changes
scim-chewing_0.3.1-1ubuntu5_i386.deb
#!/usr/bin/perl
use warnings;
use strict;
use LWP::Simple;
my ($username,$password,$hostname) = qw(username password some.domain.name);
my $html = get("http://checkip.dyndns.com");
my $ip = $1 if $html =~ m/(\d+\.\d+\.\d+\.\d+)/;
if ($ip) {
$html = getprint("http://$username:$password\@members.dyndns.org/nic/update?system=dyndns&hostname=$hostname&myip=$ip&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG&");
print "\n";
}
1;
# zcat boot.img.gz > /dev/sda然後再把 debian-40r0-i386-netinst.iso 複製到 USB stick 上就行了
# rpm -e --nodeps python-sqlite2
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello World!\n");
return 0;
}
/msg ChanServ IDENTIFY #ChatRoom [ChatRoom's Password]這樣才能把我設定成 OP
/msg ChanServ ACCESS #ChatRoom add FourDollars 30
永源拿了兩個不同數字...
這兩個數字分別大於 1 ,也分別小於 50
永源只把這兩個數字的乘積告訴了亞譚 ...
永源再只把這兩個數字的和告訴了明歆 ...
永源問, 這兩個數字是什麼 ?
以下是亞譚和明歆的對話... (小強, 小毛, 小燕在旁坐陪)
亞譚: 我不知道這兩個數字是什麼!
明歆: 但我也還是不知道這兩個數字是什麼!
亞譚: 喔!那我知道那兩個數字是什麼了 !
明歆: 喔!那我也知道那兩個數字是什麼了 !
突然間 ....聰明的三位陪客同時也說: 我們也知道那兩個數字是什麼了 !
聰明的你, 告訴我....那兩個數字是什麼 ?
#include <stdio.h>兩篇相關的討論
#include <stdlib.h>
#include <string.h>
#include "set.h"
#define LOWER 2
#define UPPER 49
#define for_ij_do(A...) \
for (i = LOWER; i <= UPPER - 1; i++) \
for (j = i + 1; j <= UPPER; j++) \
do { A } while (0);
int main(int argc, char *argv[])
{
int i,j;
int m[UPPER * UPPER] = {0};
int a[UPPER + UPPER] = {0};
Set *setA = newSet();
Set *setB = newSet();
for_ij_do (
m[i * j]++;
);
for_ij_do (
if (m[i * j] >= 2)
appendSet(setA, newPair(i, j));
);
/* 亞譚: 我不知道這兩個數字是什麼!*/
/* setA->size == 638 */
for_ij_do (
if (findElement(setA, newPair(i, j)))
a[i + j]++;
);
for_ij_do (
if (a[i + j] >= 2 && findElement(setA, newPair(i, j)))
appendSet(setB, newPair(i, j));
);
/* 明歆: 但我也還是不知道這兩個數字是什麼!*/
/* setB->size == 629 */
memset(m, 0, sizeof(int) * UPPER * UPPER);
for_ij_do (
if (findElement(setB, newPair(i, j)))
m[i * j]++;
);
for_ij_do (
if (m[i * j] == 1 && findElement(setB, newPair(i, j)))
printf("%d %d\n", i, j);
);
/* 亞譚: 喔!那我知道那兩個數字是什麼了! */
/* 明歆: 喔!那我也知道那兩個數字是什麼了! */
destorySet(setB);
destorySet(setA);
return 0;
}
cat main.c | sed -e 's/</\</g' | sed -e 's/>/\>/' | less如果有程式有辦法把 Source Code 轉成 HTML 外加彩色應該會很方便好用吧!?
#include <stdio.h>完整的 Source Code 在 http://fd.idv.tw/tux/CMClass.tar.bz2
#include <stdlib.h>
#include <string.h>
#include "set.h"
#define LOWER 2
#define UPPER 49
int main(int argc, char *argv[])
{
int i,j;
int m[UPPER * UPPER] = {0};
int a[UPPER + UPPER] = {0};
Set *setA = newSet();
Set *setB = newSet();
Set *setC = newSet();
Node *index = NULL;
for (i = LOWER; i <= UPPER - 1; i++)
for (j = i + 1; j <= UPPER; j++) {
m[i * j]++;
a[i + j]++;
}
for (i = LOWER; i <= UPPER - 1; i++)
for (j = i + 1; j <= UPPER; j++)
if (m[i * j] >= 2)
appendSet(setA, newPair(i, j));
memset(m, 0, sizeof(int) * UPPER * UPPER);
memset(a, 0, sizeof(int) * UPPER * 2);
for (i = LOWER; i <= UPPER - 1; i++)
for (j = i + 1; j <= UPPER; j++)
if (findElement(setA, newPair(i, j))) {
m[i * j]++;
a[i + j]++;
}
for (i = LOWER; i <= UPPER - 1; i++)
for (j = i + 1; j <= UPPER; j++)
if (a[i + j] >= 2 && findElement(setA, newPair(i, j)))
appendSet(setB, newPair(i, j));
memset(m, 0, sizeof(int) * UPPER * UPPER);
memset(a, 0, sizeof(int) * UPPER * 2);
for (i = LOWER; i <= UPPER - 1; i++)
for (j = i + 1; j <= UPPER; j++)
if (findElement(setB, newPair(i, j))) {
m[i * j]++;
a[i + j]++;
}
for (i = LOWER; i <= UPPER - 1; i++)
for (j = i + 1; j <= UPPER; j++)
if (m[i * j] == 1 && findElement(setB, newPair(i, j)))
appendSet(setC, newPair(i, j));
for (index = setC->head; index != NULL; index = index->next)
printf("%d %d\n", index->curr->x, index->curr->y);
destorySet(setA);
destorySet(setB);
destorySet(setC);
return 0;
}
#include <stdio.h>
int main(int argc, char *argv[])
{
int i, j;
int a[100] = {0};
int m[2500] = {0};
for (i = 2; i < 50; i++) {
for (j = i; j < 50; j++) {
a[i+j]++;
m[i*j]++;
}
}
for (i = 2; i < 50; i++) {
for (j = i; j < 50; j++) {
if (a[i+j] == 2 && m[i*j] == 2) printf("%d %d\n", i, j);
}
}
return 0;
}
rpm -qa
rpm -qa | grep kernel
rpm -qa '*kernel*'
rpm -qa | grep kernel(鍵盤比較好敲)
rpm -qa '*kernel*'似乎應該比較快速(就程式執行的速度來看)
$ for ((i=0;i<3;i++)); do time echo $(rpm -qa '*kernel*'); done
kernel-devel-2.6.19-1.2895.fc6 kernel-headers-2.6.19-1.2895.fc6 kernel-2.6.19-1.2895.fc6
real 0m2.856s
user 0m2.640s
sys 0m0.149s
kernel-devel-2.6.19-1.2895.fc6 kernel-headers-2.6.19-1.2895.fc6 kernel-2.6.19-1.2895.fc6
real 0m2.854s
user 0m2.656s
sys 0m0.138s
kernel-devel-2.6.19-1.2895.fc6 kernel-headers-2.6.19-1.2895.fc6 kernel-2.6.19-1.2895.fc6
real 0m2.858s
user 0m2.631s
sys 0m0.141s
$ for ((i=0;i<3;i++)); do time echo $(rpm -qa | grep kernel); done果然經過 pipeline 的方法比較慢~ :)
kernel-devel-2.6.19-1.2895.fc6 kernel-headers-2.6.19-1.2895.fc6 kernel-2.6.19-1.2895.fc6
real 0m3.246s
user 0m2.738s
sys 0m0.448s
kernel-devel-2.6.19-1.2895.fc6 kernel-headers-2.6.19-1.2895.fc6 kernel-2.6.19-1.2895.fc6
real 0m3.381s
user 0m2.727s
sys 0m0.570s
kernel-devel-2.6.19-1.2895.fc6 kernel-headers-2.6.19-1.2895.fc6 kernel-2.6.19-1.2895.fc6
real 0m3.311s
user 0m2.705s
sys 0m0.546s
function getLiveURL(theURL){再用 Widget Converter 把它包回成 Yahoo! Widget 就可以用了~~~ Happy Hack! ^o^
var url=new URL();
url.location=theURL;
var contents=url.fetch(); //("mmsurl=([^\;]+)\"", "g");
var liveURLRE=new RegExp("setMovieFile\\\(\\\"([^\;]+?)\"", "g");
liveURL=liveURLRE.exec(contents);
url.location=liveURL[1];
contents=url.fetch();
liveURLRE=new RegExp("href=\\\"([^\;]+?)\"", "g");
liveURL=liveURLRE.exec(contents);
stationURL=liveURL[1];
}
1: #!/bin/sh執行後的輸出結果會是
2:
3: foo='foo'
4: echo ${foo}
5: echo ${foo:=bar}
6: echo ${foo}
7:
8: unset foo
9: echo ${foo}
10: echo ${foo:=bar}
11: echo ${foo}
foo因為 ${foo:=bar} 的意義是:
foo
foo
bar
bar
1: #!/bin/sh執行後的輸出結果會是
2:
3: foo='foo'
4: echo ${foo}
5: echo ${foo:-bar}
6: echo ${foo}
7:
8: unset foo
9: echo ${foo}
10: echo ${foo:-bar}
11: echo ${foo}
foo因為 ${foo:-bar} 的意義是:
foo
foo
bar
1: #!/bin/sh執行後的輸出結果會是
2:
3: foo='foo'
4: echo ${foo}
5: echo ${foo:+bar}
6: echo ${foo}
7:
8: unset foo
9: echo ${foo}
10: echo ${foo:+bar}
11: echo ${foo}
foo因為 ${foo:+bar} 的意義是:
bar
foo
1: #!/bin/sh執行後的輸出結果會是
2:
3: foo='foo'
4: : ${foo:?bar}
5: echo "Here"
6:
7: unset foo
8: : ${foo:?bar}
9: echo "Cannot be here."
Here因為 ${foo:?bar} 只是拿來檢查 $foo 的值存在並且不為空字串
sample.sh: line 8: foo: bar
Here
sample.sh: line 8: foo: parameter null or not set
#!/bin/sh
main ()
{
return 123
}
main
echo $?
#!/bin/sh
# FourDollars
# 2007/01/12
skip=15
function func_dict ()
{
for i in $*; do
perl -e "`tail -n +$skip $0`" $i
done
}
func_dict $* | less -r -F
exit
#!/usr/bin/perl
# Yen-Ming Lee...
...
...
#!/bin/sh
# FourDollars
# 2007/01/12
skip=23
function func_dict ()
{
for i in $*; do
perl -e "`tail -n +$skip $0`" $i
done
}
while :; do
echo -n "<Yahoo!奇摩字典> "
read word
if [ -z "$word" ]; then
echo
exit
fi
func_dict "$word" | less -r -F
done
exit
#!/usr/bin/perl
# Yen-Ming Lee...
...
...
#!/bin/sh
# FourDollars
# 2007/01/12
skip=27
function func_dict ()
{
for i in $*; do
perl -e "`tail -n +$skip $0`" $i
done
}
if [ -z "$*" ]; then
while :; do
echo -n "<Yahoo!奇摩字典> "
read word
if [ -z "$word" ]; then
echo
exit
fi
func_dict "$word" | less -r -F
done
else
func_dict $* | less -r -F
fi
exit
#!/usr/bin/perl
# Yen-Ming Lee...
...
...
NetworkManager 面板程式無法找到一些需要的資源。它無法繼續。
sudo gtk-update-icon-cache -f /usr/share/icons/hicolor