ImDisk 流程設定

  1. 下載並安裝ImDisk、rawcopy
  2. 開啟自動服務「ImDisk Virtual Disk Driver Helper」
  3. 建立虛擬磁碟 imdisk -a -t vm -s 512M -m R: -p "/fs:fat32 /v:MemDisk /q /y"
  4. 控制台 → ImDisk Virtual Disk Driver → 儲存Ramdisk
  5. 本機原則 → 電腦設定 → Windows 設定 → 指令碼 - (啟動/關機)
    • Startup.cmd imdisk -a -t vm -f C:\Ramdisk\Ramdisk.img -m R: Regedit(推薦) Windows Registry Editor Version 5.00

      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ImDisk\Parameters]
      "LoadDevices"=dword:00000001
      "FileName0"="\\??\\C:\\Ramdisk\\Ramdisk.img"
      "DriveLetter0"="R"
      "Flag0"=dword:00000200
      "Size0"=hex:00,00,00,20,00,00,00,00
    • Shutdown.cmd RD /S /Q R:\TEMP
      C:\Ramdisk\MyCmdlet\rawcopy.exe -mld \\.\R: C:\Ramdisk\RamDisk.img
      imdisk -D -m R:
  6. Fierfox browser.cache.disk.parent_directory;R:\TEMP

Tools and utilities for Windows
超小巧效能強悍的窮人版 Ramdisk-ImDisk (設定篇) | Kenmingの鮮思維

userChrome.js

  1. 安裝mozdev.org - userchromejs
  2. 重新起動Firefox
  3. 你的Profile\Chrome\userChrome.js填入下列程式 if (location == "chrome://browser/content/browser.xul")
         userChrome.import("SubScript", "UChrm"); //從SubScript資料夾載入us.js、uc.xul

給新手的userChrome.js安裝指導 - Mozest.com

關閉主機板嗶嗶聲

  1. 裝置管理員
  2. 檢視 → 顯示隱藏裝置
  3. 非隨插即用驅動程式
  4. Beep → 內容 → 驅動程式 → 已停用

Ethan & shutter-關閉Windows Beep聲
Gavin's Linux學習手札: 關閉擾人的 BB 聲 - yam天空部落

Get All Siblings

Get All Siblings — Gist Get All Siblings - JS Bin
javascript - Is there a way to select sibling nodes? - Stack Overflow

firstChild vs firstElementChild

The first child node and the first child element can be different. A node is an element node if it's nodeType is 1 (Node.ELEMENT_NODE). Text nodes and comment nodes are not element nodes. If you need the first child node of an element, use the firstChild property. firstElementChild property JavaScript

maxJsonLength 指定 JSON 字串的最大長度

maxJsonLength — Gist
jquery - Can I set an unlimited length for maxJsonLength in web.config? - Stack Overflow

Apply CSS to Content Page in Asp.NET

In MasterPage <head>
  <asp:contentPlaceholder id="head" runat="server" />
</head>
In ContentPage <asp:content cntentplaceholderid="head" runat="server">
<link rel="stylesheet" href="css/your.css" type="text/css" media="screen" />
</asp:content>

Apply CSS to Content Page in Asp.NET - Stack Overflow

document.createDocumentFragment

document.createDocumentFragment — Gist
document.createDocumentFragment - DOM | MDN
JavaScript 中的 document.createDocumentFragment | ericsk.net
JavaScript DocumentFragment

build.prop

ro.ril.hsdpa.category=28
ro.ril.hsupa.category=9
ro.telephony.call_ring.delay=0
ro.lge.proximity.delay=25
mot.proximity.delay=25
ro.ril.def.agps.mode=2
ro.ril.gprsclass=12
ro.ril.hsxpa=3

# Test Effect
dalvik.vm.checkjni=0
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
debug.performance.tuning=1
dalvik.vm.execution-mode=int:fast
dalvik.vm.verify-bytecode=0

# Faster Scrolling
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000

# Increase battery saving
pm.sleep_mode=1
ro.ril.disable.power.collapse=0

# Proximity sensor tweak
ro.telephony.call_ring.delay = 0
ro.lge.proximity.delay = 25
mot.proximity.delay = 25


2G EDGE:顯示E,為CDMA技術。下載速度為200kbps左右
2G GPRS:顯示G,為CDMA技術。下載速度為9600bps
3G UMTS:顯示3G,一樣是WCDMA技術,下載速度384Kbps
3G HSDPA:顯示H,一樣是WCDMA技術但更快,下載速度5.6~7.2Mbps
3G HSUPA:顯示H+,一樣是WCDMA技術但更快,也就是一般說的3.75G規格


ro.ril.hsxpa=0 - UMTS (2G)
ro.ril.hsxpa=1 - HSDPA (3G)
ro.ril.hsxpa=2 - HSDPA/HSUPA
ro.ril.hsxpa=3 - HSUPA

安卓系統優化Build.prop 系統參數屬性詳解,系統性能調整,LG Optimus LTE/P930 安卓論壇

遠端方法呼叫(Page Method)

  1. ScriptManager的EnablePageMethods屬性設定為True
  2. 後置程式碼method需加上[System.Web.Services.WebMethod] 修飾語,並宣告成靜態方法(Static or Share)。
  3. Javascript呼叫方式:PageMethods.MethodName(參數,CallbackFunction)。
  4. 注意:無法使用在User Control與Custom Control裡。

[ASP.NET]91之ASP.NET由淺入深 不負責講座 Day27 - AJAX.NET(3) - In 91- 點部落

不支援這個伺服器版本

當您嘗試使用 Microsoft Visual Studio 2005 Service Pack 1 設計工具開啟 Microsoft SQL Server 2008 資料庫連線時,此更新會解決下列錯誤訊息:
「不支援這個伺服器版本。僅支援 Microsoft SQL Server 2005 以上的伺服器。」
Microsoft SQL Server 2008 支援的 Microsoft Visual Studio 2005 Service Pack 1 更新

Send To Context Menu - Remove or Show Drives

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoDrivesInSendToMenu"=dword:00000001

Send To Context Menu - Remove or Show Drives - Vista Forums

FireGestures執行按鍵指令

Ctrl+Shift+E => 呼叫出panorama分頁群組
FireGestures執行按鍵指令 — Gist

event.initKeyEvent - Document Object Model (DOM) | MDN
Re: [-Fx-] FireGestures腳本問題 - 看板 Browsers - 批踢踢實業坊

Get 301 Moved Location

Processing HTTP 301 HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(links[i]);
myHttpWebRequest.AllowAutoRedirect = false;
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
Console.WriteLine(myHttpWebResponse.GetResponseHeader("Location"));
myHttpWebResponse.Close();

Verify Http URI public static bool IsValidHttpUri(string uriString)
{
    Uri test = null;
    return Uri.TryCreate(uriString, UriKind.Absolute, out test) && test.Scheme == "http";
}

.net - Using WebClient in C# is there a way to get the URL of a site after being redirected? - Stack Overflow
c# - RegEx to detect syntactically correct URL - Stack Overflow

今日我最美

appledaily — Gist
[Bookmarklet] appledaily — Gist

S3 x 藍牙 x 桌機 x AirDroid

  1. Win7 和 S3 透過藍牙配對
  2. 開啟3G
  3. S3 → 設定 → 更多設定 → 數據連線與可攜式無線基地台 → 藍牙網路共享[打勾]
  4. 控制台 → 硬體和音效 → 裝置和印表機 → GT-I9300 → 連線 → 存取點
  5. 開心使用AirDroid

轉換純文字超連結

var entry=document.querySelector("div.entry-content");
entry.innerHTML=entry.innerHTML.replace(/(http:\/\/.*)<\/p>/g,"<a  style=\"color:blue; text-decoration:underline;\" target=\"_blank\" href=\"$1\">$1</a>");
NOTE:使用inline css是因為行內套用(Inline) > 嵌入套用(Embed) > 外部連接套用(External Link)

Samsung Galaxy S3 原廠相機完全無聲

  1. 複製&備份
    /system/csc/feature.xml
  2. 找到<!-- Camera -->,在下一行加入
    <CscFeature_Camera_ShutterSoundMenu>true</CscFeature_Camera_ShutterSoundMenu>
  3. 重新開機
  4. 相機→設定→快門音

將/system/media/audio/ui/裡,下列檔案加上.bak
  • Auto_Focus.ogg
  • Auto_focus_error.ogg
  • Cam_Start.ogg
  • Cam_Stop.ogg
  • camera_click.ogg
  • Camera_click_short.ogg
  • Camera_empty.ogg
  • camera_focus.ogg
  • Shutter.ogg
  • Shutter_multiple.ogg

[分享] S3 關閉快門聲方法 (免安裝apk,需root) - SAMSUNG (Android) - Mobile01
(Req) Mod Samsungcamera.apk - xda-developers (#10)
tEre-tErRiTOrY » Galaxy Note II (6) – 刪掉相機快門和對焦聲

Deodexed vs Odexed

DeodexedOdexed
首次進入系統的時間稍慢稍快
程式執行速度稍慢稍快
修改ROM及反編譯方便性方便困難,可避免被竄改
系統檔案體積較小較大
主要適合對象有相關基礎的開發者一般使用者

RSK Special Edition Deodexed &Odexed [07/07補充] - 天馬行空飛行城

zipalign (an archive alignment tool)

用途:統一將Data structure alignment限定為4-byte boundaries。
  1. zipalign 複製到下列路徑,並將權限更改為755/system/bin/
  2. zipalign_apks.sh 複製到下列路徑,權限同樣也是755/system/etc/
  3. 執行 zipalign_apks.sh
  4. 如無顯示執行結果,請查看下列路徑之Log/data/zipalign.log

command ver. adb shell su
mount -o remount,rw /system
adb push zipalign /system/bin
adb push zipalign_apks /system/etc/zipalign_apks.sh
adb shell chmod 755 /system/bin/zipalign /system/etc/zipalign_apks.sh
adb shell mount -o remount,ro /system

zipalign | Android Developers
Android,Android 進階技術討論,使用zipalign來替你的應用程式優化-GPhonefans.net

The easy tips of Samsung Galaxy S3

  • 刷回原廠
    1. 安裝TriangleAway,回復custom binary
    2. 安裝原廠*.tar.md5
    3. 雙wipe
  • 隱藏多媒體檔案(不會顯示於“媒體瀏覽器”)
    1. 將.nomedia放至欲隱藏之資料夾目錄內
    2. 設定→應用程式管理員→全部→媒體瀏覽器→清除資料
    3. 設定→應用程式管理員→全部→媒體儲存空間→清除資料
    4. 重新開機

Make Directery From Text File

FOR /F %i IN (list.txt) DO MD %i
list.txt aa
bb
cc

簡易四捨五入

之前參加就博會面試時,寫的簡易四捨五入 四捨五入 - JS Bin

nextSibling VS nextElementSibling

<p id="P1">Hello World</p>
<p id="P2">Hello Baby</p>

document.getElementById("P1").nextsibling //return [object Text]
document.getElementById("P1").nextElementSibling //return [object HTMLParagraphElement]

Example by JS Bin
Node.nextSibling - MDN
Element.nextElementSibling - MDN

Detect a key double press

~Esc::
if (A_PriorHotkey <> A_ThisHotkey or A_TimeSincePriorHotkey > 400)
{
    ; Too much time between presses, so this isn't a double-press.
    KeyWait, Esc
    return
}
WinMinimize, A    ; Assign a hotkey to minimize the active window.
;another example ↓ using to quick close the application
;Run, cmd /c TASKKILL /IM chrome.exe
return

keyboard shortcuts - Detect a double key press in AutoHotkey - Stack Overflow

WHERE

where /R F: "*我不很*.mp3" 也可以用dir達成一樣效果 dir 我不很*.mp3 /S
Where
The Will Will Web | Windows 要如何快速找到特定執行檔的所在目錄 ( which )

Windows 7 快速鍵

[視窗鍵] + 上方向鍵:視窗最大化
[視窗鍵] + 左方向鍵:視窗靠左最大化
[視窗鍵] + 右方向鍵:視窗靠右最大化
[視窗鍵] + 下方向鍵:視窗最小化
[視窗鍵] + [數字鍵]:開啟工作列上所在位置與數字對應的程式
[視窗鍵] + [數字鍵] + [ALT]:工具列開啟的程式的進階選單
[視窗鍵] + [T]:開啟工作列上開啟程式的預覽,重複按可依序切換
[視窗鍵] + [+]:放大鏡(放大) ,重複按可放大倍率
[視窗鍵] + [-]:放大鏡(縮小) ,重複按可縮小倍率
[視窗鍵]+[B] : 滑鼠游標移動至System Tray(通知區域)的圓形按鈕上,接著便可用方向鍵移游標
[視窗鍵]+[E] : 開啟檔案總管(Explorer)
[視窗鍵]+[R] : 開啟命令執行視窗(Run)
[視窗鍵]+[M] : 所有視窗最小化(Minimized)
[視窗鍵]+[Shift]+[M] : 取消最小化
[視窗鍵]+[D] : 切換顯示桌面(Desktop)
[視窗鍵]+[Home] : 除了目前視窗外,其餘視窗最小化
[Ctrl]+[Shift]+[Esc] : 開啟工作管理員
[Ctrl] + [Shift] + [N]:在檔案總管中新增資料夾
[快速鍵]Windows 7的快速鍵總整理 | Windows 7

如何複製超連結的文字

  1. 按住 ALT
  2. 按住左鍵選取超連結上的文字 (選取完後左鍵還是按住的)
  3. 按住右鍵
  4. 此時依序放開 ALT左鍵右鍵

Browny Walking: [tip] 如何複製連結中的文字 – How to copy single word in the link

DOMParser()

var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "http://www.wretch.cc/album/show.php?i=x9079&b=53&f=1188967273&p=1&sp=0", false);
xmlHttp.send(null);
var parser = new DOMParser();
var doc=parser.parseFromString(xmlHttp.responseText,"text/html");
window.open(doc.querySelector("#DisplayImage").src);

DOMParser - MDN

f12.wretch.yimg

因為之前開發的Give Me Bigger吃鱉了,抓不到f12.wretch.yimg原圖
故開發本腳本 ,先用XMLHttpRequest解決之,爾後再看看有無好辦法
版本記錄
  • 2012-06-25
    • 綁定AutoPagerize事件
  • 2012-06-24
    • 初版
    • 修正部份版型不同,而抓不到原圖的問題

// ==UserScript==
// @name           f12.wretch.yimg
// @description    顯示原圖、開新分頁
// @author    NKid
// @version    2012-06-24
// @include       http://www.wretch.cc/album/album.php?id=*&book=*
// ==/UserScript==
GM_registerMenuCommand('f12.wretch.yimg - Setting width of images', settingImgWidth);
var oriTitle=document.title;    //原始標題
function getDocFromXHR(url) {
        var xmlHttp = new XMLHttpRequest();
        xmlHttp.open("GET", url, false);
        xmlHttp.send(null);
        return new DOMParser().parseFromString(xmlHttp.responseText,"text/html");
}
//Setting width of images
function settingImgWidth() {
    var oldIW=GM_getValue('imgwidth')||240;    //(Default Value:240)
    GM_setValue('imgwidth', prompt('Please Enter the width(px) of images.', oldIW));
}
function APEvent() {
    var untreatedImgs=document.querySelectorAll("td.side a img[src*='thumbs/t']");    //尚未處理的圖片
    document.title= "AutoPagerize Working";
    for(var i=0;i<untreatedImgs.length;i++)
    {
        untreatedImgs[i].parentNode.target="_blank";
        var doc=getDocFromXHR(untreatedImgs[i].parentNode.href);
        var paraF=/f=(\d*)&/.exec(untreatedImgs[i].parentNode.href)[1];
        if (doc.getElementById("DisplayImage"))
            untreatedImgs[i].src=doc.getElementById("DisplayImage").src;
        else if (doc.querySelector("img[src*='"+ paraF +"']"))
            untreatedImgs[i].src=doc.querySelector("img[src*='"+ paraF +"']").src;
    }
    document.title=oriTitle;
}
function main() {
    var picLinks=document.querySelectorAll("td.side a");    //圖片超連結
    var totalImgLength=picLinks.length;    //圖片總數
    var imgWidth=parseInt(GM_getValue('imgwidth')||240,10)    //圖片寬度
    GM_addStyle('td.side img{max-width:@imgwidthpx}'.replace('@imgwidth',imgWidth));
    for(var i=0;i<picLinks.length;i++)
    {
        picLinks[i].target="_blank";
        var doc=getDocFromXHR(picLinks[i].href);
        var paraF=/f=(\d*)&/.exec(picLinks[i].href)[1];
        if (doc.getElementById("DisplayImage"))
            picLinks[i].children[0].src=doc.getElementById("DisplayImage").src;
        else if (doc.querySelector("img[src*='"+ paraF +"']"))
            picLinks[i].children[0].src=doc.querySelector("img[src*='"+ paraF +"']").src;

        document.title= (i+1) + " / " + totalImgLength;
    }
    document.title=oriTitle;
    window.addEventListener("AutoPagerize_DOMNodeInserted",APEvent,false);
}
main();

嘸蝦米使用注音查碼

注音查詢功能的快速碼為「、;」,也就是鍵盤的「' ;」,設定這兩個靠近的按鍵是方便使用者能快速以小指及無名指鍵入此快速碼。 行易有限公司 :: 嘸蝦米輸入法

Firefox using window.close()

  1. Go to address bar and type about:config
  2. Go to parameter dom.allow_scripts_to_close_windows
  3. Set its value as true

javascript - How do I close a firefox tab from a greasemonkey script? - Stack Overflow

EZ Recorder

// ==UserScript==
// @name    EZ Recorder [ExampleSite]
// @description    簡易記錄已讀主題
// @author    NKid
// @version    2012-06-22
// @run-at document-end
// @include        http://ExampleSite.net*
// ==/UserScript==
GM_addStyle('.GM_recorded  {background-color:#00A9D8  !important;}');
GM_registerMenuCommand('EZ Recorder [ExampleSite] - Clear Records ',clearRecord);
var siteName="ExampleSite";
var titleSelector="h2.entry-title a";

function clearRecord() {
    if (confirm('Do you want to clear the record?'))
    {
        window.localStorage.removeItem(siteName);
        GM_notification('Clear The Record Of This Site.',null);
    }
}
function titleClick(event) {
    //記錄主題id並上色
    event.preventDefault();
    event.target.className="GM_recorded";
    localStorage.setItem(siteName,event.target.href);
    GM_notification('Recorded.',null);
}
//trigger設定事件
function setTitleClickEvent() {
        var titles=document.querySelectorAll(titleSelector);
        for(var i=0;i<titles.length;i++)
            titles[i].addEventListener('click',titleClick,false);
}

function markThisPage() {
        if (localStorage.getItem(siteName) != null)
        {
            var record=localStorage.getItem(siteName);
            var titles=document.querySelectorAll(titleSelector);
            for(var i=0;i<titles.length;i++)
                if (record ==titles[i].href) titles[i].className="GM_recorded";
        }
}
function showRecord() {
    prompt("The record of this site.",localStorage.getItem(siteName));
}
setTitleClickEvent();
markThisPage();

can't establish secure connection

檢查系統時間,使用NTPClock校正

顯示桌面 (Windows Explorer commands)

下列文字,存檔成xxx.scf [Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop

sorting by file size

DirectoryInfo dir = new DirectoryInfo("K:\\VGD-103");
FileInfo[] files= dir.GetFiles("*.rar");

Array.Sort(files, (f1, f2) => f1.Length.CompareTo(f2.Length));    //排序檔案大小

foreach (FileInfo f in files)
    Console.WriteLine("{0}\t{1}",f.Name,f.Length/1024);

system.io - How to sort an array of FileInfo[] C# - Stack Overflow

泛型處理常式(Generic Handler) 讀取Session

引用System.Web.SessionState與實作IReadOnlySessionState
[ASP.NET & jQuery]使用jQuery的Ajax存取資料(ashx,aspx,asmx) - In 91- 點部落
The Will Will Web | 在 HttpHandler 中使用 Session 的注意事項

SqlDataSource.Select()

方法1:
DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
int reorderedProducts = (int)dv.Table.Rows[0][0];
方法2:
DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
DataTable dt = dv.ToTable();
foreach (DataRow i in dt.Rows)
{
    Response.Write(i["欄位名"].ToString());
}
方法3:

SqlDataSource.Select 方法 (System.Web.UI.WebControls)
JHPeng's Blog:宏觀篇。: SqlDataSource抓全部資料

FDZ Thread Recorder

版本記錄
  • 2012-05-24
    • 更名為“FDZ Thread Recorder”
    • 使用localStorage存取記錄
    • 各區分開儲存記錄
  • 2012-05-11
    • 初版,命名為“FDZ Record TIDs”
    • 使用GM_setValue()儲存記錄

// ==UserScript==
// @name    FDZ Thread Recorder
// @description    記錄已讀主題
// @author    nightkid@FDZ
// @version    2012-05-25
// @run-at document-end
// @include    http://forum.fdzone.org/forumdisplay.php?fid=*
// @include    http://forum.*.fdzone.org/forumdisplay.php?fid=*
// @include    http://pro.fdzone.org/forumdisplay.php?fid=*
// @include    http://pro.*.fdzone.org/forumdisplay.php?fid=*
// ==/UserScript==
GM_addStyle('#GM_recordBtn {-moz-border-radius: 3px; background-color: #006699; color: #000000; cursor: pointer; font-size: 10px; height: 15px; position: fixed; right: 20px; top: 3px; width: 15px;}');
GM_addStyle('.GM_recorded td, .GM_recorded th {background-color:#006699  !important;}');
GM_registerMenuCommand('FDZ Thread Recorder - Show All Records',showAllRecords);
GM_registerMenuCommand('FDZ Thread Recorder - Clear Records Of This Forum',clearThisForum);
GM_registerMenuCommand('FDZ Thread Recorder - Remove Repetition',removeRepetition);
var removeStr=new RegExp ("(stick|normal)thread_","g");
var fid=location.href.replace(/.*fid=(\d{1,3}).*/,'$1');    //子區塊編號
function clearThisForum() {
    if (confirm('Do you want to clear this forum?'))
    {
        window.localStorage.removeItem(fid);
        GM_notification('Clear Records Of This Forum.',null);
    }
}
function recordBtn() {
    var btn = document.createElement("div");
    btn.id="GM_recordBtn";
    btn.title="Record all threads of this page.";
    btn.accessKey="A";
    document.getElementsByTagName("body")[0].appendChild(btn);
    document.getElementById('GM_recordBtn').addEventListener('click',function(){ recordThisPage();},false);
}
function recordThisPage() {
    var uids=document.querySelectorAll("tbody[id*=thread_]");
    var tmp=[];
    for(var i=0;uids[i];i++)
        tmp.push(uids[i].id.replace(removeStr,""));
    localStorage.setItem(fid, tmp.join() + checkNull(localStorage.getItem(fid)));
    markThisPage();
    removeRepetition();
}
function setThread(event) {
    //記錄主題id並上色
    //em → th → tr → tbody
    var tidEle=document.getElementById(event.target.parentNode.parentNode.parentNode.id);
    localStorage.setItem(fid, tidEle.id.replace(removeStr,"") + checkNull(localStorage.getItem(fid)));
    tidEle.className="GM_recorded";
    GM_notification('Recorded.',null);
}
//trigger設定事件
function setThreadEvent() {
    var t=document.querySelectorAll('tbody[id] >tr > th > em');
    for(var i=0;i < t.length;i++)
    {
        t[i].addEventListener('click',setThread,false);
        t[i].style.cursor='pointer';
    }
}

function removeRepetition() {
    if (localStorage.getItem(fid) != null)
    {
        var allRecords=localStorage.getItem(fid).split(",");
        var tmp=[];
        for(var i=0;i < allRecords[i];i++)
        {
            var tmpRegx=new RegExp(allRecords[i],"g");
            if (!( tmpRegx.test(tmp)))
                tmp.push(allRecords[i]);
        }
        localStorage.setItem(fid,tmp.join());
        GM_notification("Delete " + (allRecords.length - tmp.length) + " Repetition(s)");
    }
}
function markThisPage() {
    if (localStorage.getItem(fid) != null)
    {
        var allRecords=localStorage.getItem(fid);
        var uids=document.querySelectorAll("tbody[id*=thread_]");
        for(var i=0;uids[i];i++)
            if (allRecords.indexOf(uids[i].id.replace(removeStr,"")) != -1)
                uids[i].className="GM_recorded";
    }
}
function showAllRecords() {
    console.log(localStorage);
}
function checkNull() {
    return (arguments[0] == null)?"":("," + arguments[0].split(","));
}
/*function delAllRecords() {
    localStorage.clear();
    GM_notification('Delete all records.');
}*/
setThreadEvent();
recordBtn();
markThisPage();

Node.insertBefore()

var hr = document.createElement("hr");
hr.style.borderColor="#000";
var body=document.getElementsByTagName("body")[0];
body.insertBefore(hr,body.childNodes[2]);

Node.insertBefore - MDN

Middle Paste 2

熊熊想到AHK可以寫入txt,故再次精減流程
  • 在Firefox裡,按中鍵,寫入剪貼簿內容至list.txt,每三次就自動多換一行 
  • 在SMG主畫面,按中鍵,貼上下載碼
  • 在SMG新增下載檔案,按中鍵,自動貼上剪貼簿內容至下載路徑且送出確定
  • 在SMG新增下載檔案,Ctrl + C,自動組成下載路徑,並複製編號部份
  • 在SMG新增下載檔案,Ctrl + Z,跳至『儲存到』
  • Win + Z 開啟list.txt

;開啟list.txt
#z::Run notepad "K:\list.txt"

;Firefox 中鍵新增剪貼簿內容至list.txt
#IfWinActive ahk_class MozillaWindowClass
MButton::
L++
IF ( L = 1 )
{
    ;StringUpper, Clipboard, Clipboard
    FileAppend, %Clipboard%`n, K:\list.txt
    TrayTip, MiddlePaste, 新增編號`n%Clipboard%,1
}
IF ( L = 2 )
{
    IfInString, Clipboard, http://
    {
        FileAppend, %Clipboard%`n, K:\list.txt
        TrayTip, MiddlePaste, 新增網址`n%Clipboard%,1
    }
    Else
    {
        SoundBeep
        TrayTip, MiddlePaste, 格式錯誤,1
    }
}
IF ( L = 3 )
{
    FileAppend, %Clipboard%`n, K:\list.txt
    TrayTip, MiddlePaste, 新增解壓縮密碼,1
    FileAppend, `n, K:\list.txt
    L=0
}
Return

;SMG新增下載檔案 中鍵貼上編號
#IfWinActive ahk_class TAddDownloads.UnicodeClass
MButton::
ControlFocus, 一般設定
Send {TAB 6}
;StringUpper, Clipboard, Clipboard
Send K:\%Clipboard%
Send {Enter}
Return

;SMG新增下載檔案 Ctrl + C 自動組成下載路徑,並複製編號部份,自動轉大寫
#IfWinActive ahk_class TAddDownloads.UnicodeClass
^c::
Send {End}
Send +{Home}
Send ^c
;StringUpper, Clipboard, Clipboard
Send K:\%Clipboard%\
Return

;SMG新增下載檔案 Ctrl + Z 跳至『儲存到』
#IfWinActive ahk_class TAddDownloads.UnicodeClass
^z::
ControlFocus, 一般設定
Send {TAB 6}
Return

;SMG主視窗 中鍵貼上
#IfWinActive ahk_class TMainForm.UnicodeClass
MButton::
Send {F4}
Return

Resize Window

; win + w Resize Winodw to 1024(w), 1052(h)
#W::ResizeWin(1024,1052)

ResizeWin(Width = 0,Height = 0)
{
    WinGetPos,X,Y,W,H,A
    If %Width% = 0
        Width := W
    If %Height% = 0
        Height := H
    WinMove,A,,%X%,%Y%,%Width%,%Height%
}

Create a Hotkey to Resize Windows to a Specific Size with AutoHotkey - How-To Geek

M01 文章內容限閱提示

// ==UserScript==
// @name           M01 Content Restrict
// @description    M01 Content Restrict
// @include        http://www.mobile01.com/forumcontentrestrict.php?f=*
// @include        http://www.mobile01.com/forumcontentrestrict.php?f=*
// ==/UserScript==
document.querySelector("input[value=confirm]").checked=true;
document.getElementById("confirm_form").submit();

文章內容限閱提示 - Mobile01

Record Thread HTML5

// ==UserScript==
// @name    Record Thread HTML5
// @description    標記閱讀文章
// @run-at document-end
// @author    NKid
// @version    2011-07-08
// @include    http://forum.*.fdzone.org/forumdisplay.php?fid=*&orderby=dateline*
// @include    http://forum.fdzone.org/forumdisplay.php?fid=*&orderby=dateline*
// @include http://pro.fdzone.org/forumdisplay.php?fid=*&orderby=dateline*
// @include http://pro.fdzone.org/forumdisplay.php?fid=*&filter=subject#by
// ==/UserScript==
GM_addStyle('.GM_RecordThread {background-color:#006699 !important;}');
GM_registerMenuCommand('Record Thread HTML5 - [Clear Record] This Forum',clearThisForum);
GM_registerMenuCommand('Record Thread HTML5 - [Clear Record] All Forums',clearAllForums);
GM_registerMenuCommand('Record Thread HTML5 - [Sync] Upload Records',syncUpload);
GM_registerMenuCommand('Record Thread HTML5 - [Sync] Download Records',syncDownload);
GM_registerMenuCommand('Record Thread HTML5 - [Show] All Records',showAllRecords);
GM_registerMenuCommand('Record Thread HTML5 - TEST Upload Json',testUploadJson);
GM_registerMenuCommand('Record Thread HTML5 - TEST Download Json',testDownloadJson);
var fid=location.href.replace(/.*fid=(\d{1,3}).*/,'$1');    //子區塊編號
var serverIP=['140.127.22.228','140.127.22.219'];
function testUploadJson() {
    var strRecords='';
    for(var i=0;i<localStorage.length;i++)
        strRecords+=',{"tid":"' + localStorage.key(i) + '" , "fid":"' + localStorage.getItem(localStorage.key(i)) + '"}';

    var json='{"timestamp": "@timestamp","records": [@records]}';
    json=json.replace('@timestamp',localStorage.getItem('timestamp'));
    json=json.replace('@records',strRecords.substring(1));
    GM_xmlhttpRequest({
            method: "POST",
            url: "http://140.127.22.228/RecordThread/RecordThread.ashx",
            data: json,
            headers: {"Content-Type": "application/x-www-form-urlencoded","a":"testUploadJson","h":location.hostname},
            onload: function(response) {GM_notification('Done.',null);}
        });
}
function testDownloadJson() {
        GM_xmlhttpRequest({
            method: "POST",
            url: "http://140.127.22.228/RecordThread/RecordThread.ashx",
            data: null,
            headers: {"Content-Type": "application/x-www-form-urlencoded","a":"testDownloadJson","h":location.hostname},
            onload: function(response) {
                var j=JSON.parse(response.responseText);
                alert(j.timestamp);
            }
        });
}
function showAllRecords() {
        var str='';
        for(var i=0;i<localStorage.length;i++)
            str+=localStorage.key(i) + ' : ' + localStorage.getItem(localStorage.key(i)) + '\n';
        ( str== '')?alert('No Records'):alert(str.replace(/\n$/,''));
}
function chooseIP() { return serverIP[prompt('[0]140.127.22.228\n[1]140.127.22.219')];}
function syncDownload() {
    GM_xmlhttpRequest({
        method: "POST",
        url: "http://" + chooseIP() + "/RecordThread/RecordThread.ashx",
        data: null,
        headers: {"Content-Type": "application/x-www-form-urlencoded","a":"download","h":location.hostname},
        onload: function(response) {
            //console.log(response.responseText.split('\n'))
            //GM_notification('Donwloaded Record.',null);
            if (confirm('Do you want to replace the original records of \"' + location.hostname + '\" ?'))
            {
                window.localStorage.clear();
                var newRecords=response.responseText.split('\n');
                for(var i=0;i<newRecords.length;i++)
                {
                    var red=newRecords[i].split(':');
                    window.localStorage.setItem(red[0],red[1]);
                }
                GM_notification('Donwloaded Records.',null);
            }
        }
    });
}
function syncUpload() {
    if (confirm('Do you want to upload all records of \"' + location.hostname +'\" ?'))
    {
        var records=new Array();
        for(var i=0;i<localStorage.length;i++)
            records.push(localStorage.key(i) + '=' + localStorage.getItem(localStorage.key(i)));
        GM_xmlhttpRequest({
            method: "POST",
            url: "http://" + chooseIP() + "/RecordThread/RecordThread.ashx",
            data: records.join('&'),
            headers: {"Content-Type": "application/x-www-form-urlencoded","a":"upload","h":location.hostname},
            onload: function(response) {GM_notification(response.responseText,null);}
        });
    }
}
function clearThisForum() {
    if (confirm('Do you want to clear this forum?'))
    {
        window.localStorage.removeItem(fid);
        GM_notification('Clear Record This Forum.',null);
    }
}
function clearAllForums() {
    if (confirm('Do you want to clear all forums?'))
    {
        window.localStorage.clear();
        GM_notification('Clear Record All Forum.',null);
    }
}
//上色
function markThread(eles) {
        for(var i=0;i<eles.length;i++)
            eles[i].className='GM_RecordThread';
}
//取得文章編號
function getThread() {
    var tid=window.localStorage.getItem(fid);
    //尚無記錄
    if (tid == null)
    { GM_notification('No Record.',null); }
    else    ///有記錄
    {
        //在本頁
        if (document.getElementById(tid))
        {
            GM_notification('Found in this page.',null);
            var allEles=document.querySelectorAll('#'+ tid+ ' > tr > :nth-child(n)');
            markThread(allEles)
        }
        else    //不在本頁
        {
            GM_notification('Found, but not in this page.',null);
        }
    }
}
//設定文章編號
function setThread(event) {
    //清掉舊主題的上色
    var allEles=document.getElementsByClassName('GM_RecordThread');
    var len=allEles.length
    for(var i=0;i<len;i++)
        allEles[0].className='';
    //記錄主題id並上色
    //em → th → tr → tbody
    var tidEle=document.getElementById(event.target.parentNode.parentNode.parentNode.id);
    window.localStorage.setItem(fid,tidEle.id);
    var allEles=tidEle.querySelectorAll('tr > :nth-child(n)');
    markThread(allEles);
    GM_notification('Saved.',null);
}
//trigger設定事件
function setThreadEvent() {
    var t=document.querySelectorAll('tbody[id] >tr > th > em');
    for(var i=0;i < t.length;i++)
    {
        t[i].addEventListener('click',setThread,false);
        t[i].style.cursor='pointer';
    }
}
getThread();
setThreadEvent();

Remove Autoplay Music

// ==UserScript==
// @name    Remove Autoplay Music
// @description    移除自動播放的音樂
// @run-at document-end
// @author    NKid
// @version    2012-02-20
// @include    http://www.wretch.cc/blog/*
// @include    http://www.wretch.cc/album/*
// @include    http://www.wretch.cc/user/*
// ==/UserScript==
var bgm=document.querySelector('embed[src*="BGMusicPlayer.swf"]');
if (bgm)
{
    GM_notification('Remove BGM',null);
    bgm.parentNode.removeChild(bgm);
}
var fs=document.querySelectorAll('iframe');
if (fs)
{
GM_notification('Remove iframe',null);
for(var i=0;fs[i];++i)
    fs[i].parentNode.removeChild(fs[i]);
}
var obj=document.querySelectorAll('object');
for(var i=0;obj[i];++i)
{
    if(obj[i].data.indexOf('.swf') != -1)
    {
        obj[i].parentNode.removeChild(obj[i]);
        GM_notification('Remove object',null);
    }
}

設定C# Console字型顏色

Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("ABC");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("ABC");