Skip to content

Instantly share code, notes, and snippets.

@andyyou
Last active January 9, 2019 02:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyyou/1efe82615eaddce1ea0a7415ce70cd8c to your computer and use it in GitHub Desktop.
Save andyyou/1efe82615eaddce1ea0a7415ce70cd8c to your computer and use it in GitHub Desktop.
windows 10 大尺度私房菜

windows 10 大尺度私房菜

  • Configure & Install subsystem for linux
# https://docs.microsoft.com/en-us/windows/wsl/install-win10
$ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
$ choco install firacode
$ choco install git
{
  "editor.fontLigatures": true,
  "editor.tabSize": 2,
  "editor.fontSize": 14,
  "editor.fontFamily": "'Fira Code', Consolas, 'Courier New', monospace"
}
@andyyou
Copy link
Author

andyyou commented May 29, 2018

@andyyou
Copy link
Author

andyyou commented Jun 26, 2018

windows 10 開發環境

Support Ubuntu on Windows

# https://docs.microsoft.com/zh-tw/windows/wsl/install-win10
$ Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
$ lsb_release -a # Show Ubuntu version
  • cmder
  • cmder 不需要安裝,設定檔會存在目錄下,不會使用機碼。mini 版和 full 版的差異,有無內建 msygit。有安裝 git for windows 的話可以使用 mini 版。

Fix powershell issues

# 遇到錯誤:因為這系統已停用指令碼...
$ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Runing Ubuntu bash using Cmder

預設

加入 bash::ubuntu

nvm

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Ubuntu 與 windows 目錄

# windows -> ubuntu
# NOTE: You have to uncheck "Hide protected operating system files (recommended)" in the folder options window.
$ C:\Users\<UserName>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\allen

# ubuntu terminal -> windows
$ cd /mnt/<C:\, D:\>

ssh-key

$ ls ~/.ssh
$ ssh-keygen -t rsa -b 4096 -C "your@email.com"
# OR
# id25519
$ ssh-keygen -o -a 100 -t ed25519 -C "your@email.com"
# puts keys into C:\Users\<UserName>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\allen\.ssh\
$ eval `ssh-agent -s`
$ ssh-add id_ras

electron

* https://github.com/electron-userland/electron-prebuilt/issues/260

TODO

  • open pbcody 怎麼使用
  • ssh kye 設定
  • 查詢當前 git config and username

Add alias

alias open="explorer.exe"
alias pbcopy="clip.exe"

open 指令

軟體列表

@andyyou
Copy link
Author

andyyou commented Jun 27, 2018

@pjchender
Copy link

pjchender commented Nov 22, 2018

Install Ruby on Rails

Install Ruby directly on RubyInstaller.

Install SQLite and Integrate with Ruby on Rails

ridk exec pacman -S mingw-w64-x86_64-sqlite3
gem install sqlite3 --platform ruby

Error Handling: cannot load such file -- sqlite3/sqlite3_native

  1. Move into the path of sqlite3 gem
cd C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13-x64-mingw32
  1. Run the code below
ridk enable
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb  install
  1. Test if it run correctly
irb
require "sqlite3"    # true

Install PostgreSQL and integrate with Ruby on Rails

Install PSQL from official website directly.

  1. Set all METHOD in pg_hba.conf as trust on both IPv4 and IPv6, the file path of pg_hba.conf is %HOMEPATH%\psql\pg_hba.conf in Windows.

  2. Open the app pgAdmin in program files, create an new role. Check image here if needed.

  3. The name of the role SHOULD BE SAME AS the system user, leave the password field empty and make the privilege as SUPERUSER.
    Check image here.

The pg_hba.conf should look like the settings below:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment