Windows 硬碟無法延伸磁碟區

刪除分割區

  • diskpart.exe
  • list disk
  • select disk 0
  • list partition
  • select partition 2
  • delete partition override

無法格式化 (清空整個磁碟,再做主分割)

  • diskpart.exe
  • list disk
  • select disk 0
  • clean
  • create partition primary
view raw step.md hosted with ❤ by GitHub

exiftool csv匯入資料

Step1 匯出原本資料

exiftool.exe -csv Z:\20170101 > exif.csv
保留SourceFile欄位
新增DateTimeOriginal

Step2 使用momentjs產生時間(間隔1秒)

var a = moment('2017-01-01 06:50:00');
var tmp = [];
for (var i = 0; i < 100; i++) {
    tmp.push(a.add(1, 's').format('YYYY:MM:DD HH:mm:ss+08:00'));
}

Step3 使用PowerShell批次執行exiftool

AllDates is a shortcut for 3 tag names: DateTimeOriginal, CreateDate and ModifyDate.

$csv = import-csv -LiteralPath Z:\exif.csv
$exiftool = "C:\exiftool.exe"
$files = Get-ChildItem -LiteralPath Z:\20170101 -File
foreach($row in $csv){
   &$exiftool -alldates="$($row.DateTimeOriginal)" $row.SourceFile
}
view raw Step.md hosted with ❤ by GitHub

Path 相對、絕對路徑

let path = require('path');
// 相對路徑 (隨著啟動目錄變動)
console.log(process.cwd());
console.log(path.resolve('./'));
console.log(path.resolve('../')); //上一層
// 絕對路徑 (依據該js檔案位置)
console.log(__dirname);
console.log(__filename);
console.log(path.resolve(__dirname, 'abc', 'def'));
console.log(path.resolve(__dirname, '../demo.js')); //上一層
//讀取上一層資料夾的_utils資料夾的myRequest.js
const myReq = require(path.resolve(__dirname, '..', '_utils', 'myRequest.js'));
view raw path.js hosted with ❤ by GitHub

以Big5編碼讀取檔案

let fs = require('fs');
let iconv = require('iconv-lite');
let buff = fs.readFileSync('C:/abc.txt');
let rows = iconv.decode(buff, 'Big5').split('\r\n');
view raw big5.js hosted with ❤ by GitHub

確認刪除

@echo off
:AskUser
SET /p Ans=Enter "YES" to Delete:
if %Ans%==YES GoTo ExecDel
GoTO AskUser
:ExecDel
sdelete.exe -p 3 -s D:\Img\*.*
PAUSE
view raw confirm.bat hosted with ❤ by GitHub

Kindle進階指令

view raw note.md hosted with ❤ by GitHub

批次檔傳遞參數至Powershell

@ECHO OFF
powershell -file "C:\FolderJPG90.ps1" %1
PAUSE
view raw CallPS.bat hosted with ❤ by GitHub
$WorkPath = $args[0]
Write-Host $args[0] -BackgroundColor Blue
view raw FolderJPG90.ps1 hosted with ❤ by GitHub

設定兩張網路卡

1. 停用所有網卡

2. 啟用內部網卡

3. 清除全部路由

route delete 0.0.0.0

4. 內網路由設定

(10.97.99.1為閘道IP)
台日

route add 10.97.0.0 mask 255.255.0.0 10.97.99.1 metric 10

桃廠

route add 10.121.0.0 mask 255.255.0.0 10.97.99.1 metric 10

開門檢查

route add 10.125.0.0 mask 255.255.0.0 10.97.99.1 metric 10
route add 10.108.0.0 mask 255.255.0.0 10.97.99.1 metric 10

5. 啟用外部網卡


使用ForceBindIP綁定Firefox使用指定網卡

C:\Windows\System32\ForceBindIP.exe -i 1.2.3.4 "C:\Program Files\Mozilla Firefox\firefox.exe"

Ref

view raw step.md hosted with ❤ by GitHub

ES6 Proxy

// LANG
view raw 1.js hosted with ❤ by GitHub
let log = new Proxy({}, {get: (x, k) => (...pass) => console.log(`%c${pass.join(' ')}`, `color: ${k}`)});
log.tomato('I am tomato');
log.chocolate('I am chocolate');
log.noExistColor('I am no exist color');

Ref

view raw proxy.md hosted with ❤ by GitHub

Firefox Awesome Bar

  • Add ^ to search for matches in your browsing history.
  • Add * to search for matches in your bookmarks.
  • Add + to search for matches in pages you've tagged.
  • Add % to search for matches in your currently open tabs.
  • Add ~ to search for matches in pages you've typed.
  • Add # to search for matches in page titles.
  • Add @ to search for matches in web addresses (URLs).
  • Add $ to search for matches in suggestions.

Awesome Bar - Search your Firefox bookmarks, history and tabs from the address bar | Firefox Help