Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Friday, June 14, 2013

openssh/git on Windows

You need to install msysgit with openssh first.

Basic ssh:

  1. Check whether environment variable HOME is set by running command "echo %HOME%". If it is not set, set it (for me it is C:\Users\<username>\)
  2. Put your private/public keys into directory: %HOME%/.ssh
  3. SSH config file should be %HOME%/.ssh/config
  4. open a windows cmd window and run "ssh -T <username>@<hostname> ".
    Or open git bash window, and run the same command.

ssh-agent

Unfortunately I could not make it work by using only native Windows env.

Instead, I ran it inside git bash. In git bash,

  • run command
    eval `ssh-agent`
    ssh-add <path>/<to>/<your>/<key>

Eclipse

Open preference dialog, search for "ssh2" and configure the path of private key, etc. accordingly.

git config

Download the git config file https://sites.google.com/site/jenvor/Home/.gitconfig?attredirects=0&d=1 to %HOME%/ and change it based on your info.

Initialize a local repo and push its content to an empty remote repo:

mkdir /path/to/your/project
cd /path/to/your/project
git init
git remote add origin <your_git_ssh_or_https_path>
# add/change files/directories
git add <file>
git commit
git push -u origin --all   # for the first time only

Set-up upstream branch: git branch -u origin/master

Tuesday, April 16, 2013

File Associations in Windows Regsitry

See [1] for the description of HKLM, HKCU, and HKCR. According to [2], HKCR provides a merged view of HKCU and HKLM. For ProgID, see [3]. For file extension, see [5].

File extensions config examples (see [7] for valid keys/entries):

for .rar:

  • HKLM/SOFTWARE/Classes/.rar has a key "(Default)" with ProgID "7-Zip.rar"
  • HKCU/Software/Microsoft/Windows/CurrentVersion/Explorer/FileExts/.rar
    • child: OpenWithProgids has a key named "7-Zip.rar" (appear in "open with" menu)
for .txt:
  • HKLM/SOFTWARE/Classes/.txt (apply to all users)
    • keys: (Default)=txtfile; Content Type=text/plain (txtfile is ProgID)
    • child: OpenWithProgids (appear in "open with" menu)
    • child: ShellNew
  • HKCU/SOFTWARE/Classes/.txt (apply to the interactive user)
    • Does not exist in my case
  • HKCU/Software/Microsoft/Windows/CurrentVersion/Explorer/FileExts/.txt (apply to the interactive user)
    • child: OpenWithProgids has a ProgID "txtfile"
    • child: UserChoice has a key named "Progid" with value "Applications/notepad++.exe" (!important)

Applications with ProgID:

  • HKLM/SOFTWARE/Classes/7-Zip.rar/shell/open/command (7-Zip.rar is ProgID)
  • HKLM/SOFTWARE/Classes/txtfile/shell/open/command: the value of "(Default)" is the command used to open files.

How a file extension (e.g. .txt) is mapped to a file type?

  • "UserChoice" takes the first precedence. If it is not set, key "(Default)" stores the ProgID which can be found under [HKCU|HKLM}/SOFTWARE/Classes/.

For gvim.exe, you should have HKLM/SOFTWARE/Classes/Applications/gvim.exe/shell:

  • edit/command[(Default)] = command
  • open/command[(Default)] = command
    Notes: "gvim.exe" is ProgID, see [3] for more detail.

How to change the default app when a file is double-clicked? (Take .c as an example)

  • Solution 1 (use entries for Explorer)
    1. For HKCU/Software/Microsoft/Windows/CurrentVersion/Explorer/FileExts/.c/UserChoice, set the value of key "UserChoice" to "Applications/gvim.exe".
    2. For HKLM/SOFTWARE/Classes/Applications/gvim.exe/shell/edit/command, set the value of key "(Default)" to '"C:\Program Files (x86)\Vim\vim73\gvim.exe" -p --remote-tab-silent "%1" "%*"'
    3. Open "Control Panel\Programs\Default Programs\Set Associations", you will see .txt has been associated with gvim.exe.
  • Solution 2
    UserChoice should not be set in this solution (you can delete it first).
    1. make sure HKLM/SOFTWARE/Classes/.c has the key "(Default)" set to "cfile".
    2. For HKLM/SOFTWARE/Classes/cfile/shell/open/command, set "(Default)" to the gvim command above.

References

[1] http://msdn.microsoft.com/en-us/library/windows/desktop/ms724475%28v=vs.85%29.aspx
[2] http://msdn.microsoft.com/en-us/library/windows/desktop/ms724498%28v=vs.85%29.aspx
[3] http://msdn.microsoft.com/en-us/library/windows/desktop/dd542719%28v=vs.85%29.aspx
[4] http://msdn.microsoft.com/en-us/library/windows/desktop/ms690440%28v=vs.85%29.aspx
[5] http://msdn.microsoft.com/en-us/library/windows/desktop/ms678415%28v=vs.85%29.aspx
[6] http://msdn.microsoft.com/en-us/library/windows/desktop/hh127445%28v=vs.85%29.aspx
[7] http://msdn.microsoft.com/en-us/library/windows/desktop/cc144148%28v=vs.85%29.aspx#fa_optional_keys_attributes

Sample reg file

Be careful, it will overwrite the current value!!!
============================================

Windows Registry Editor Version 5.00 

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.c] 
@="cfile" 

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\open\command] 
@="\"C:\\Program Files (x86)\\Vim\\vim73\\gvim.exe\" -p --remote-tab-silent \"%1\" \"%*\"" 
============================================
Note: the value must be a string put in double quotations!
  

Friday, January 08, 2010

Do you know Windows 7 GodMode?

See this post for details:

http://www.osnews.com/story/22691/Activate_Windows_7_s_Hidden_God_Mode_

Just try:

  1. Create a new folder
  2. Name it: GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
  3. That's it

Friday, November 06, 2009

Windows7 7 Sins

An interesting web site: http://en.windows7sins.org