Skip to content

Instantly share code, notes, and snippets.

Converting SSH2 keys (PuTTY) to OpenSSH

ssh-keygen -i -f ssh2.pub > openssh.pub

and vise versa

ssh-keygen -e -f openssh.pub > ssh2.pub

Upload file to server with ssh

@Prince-Mandor
Prince-Mandor / Command prompt here (as Admin).reg
Created November 14, 2016 13:49
add elevated command prompt to shift-right click menu in windows
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\*\shell\runas]
[HKEY_CLASSES_ROOT\*\shell\runas]
@="Command prompt here (as Admin)"
"Extended"=""
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /s /k for %%X in (\"%V\") do @pushd %%~dpX"
@Prince-Mandor
Prince-Mandor / install-cygwin.cmd
Last active November 29, 2016 13:50
batch for fresh cygwin install
: <<TRAMPOLINE
@echo off
setlocal enableDelayedExpansion
set "options=-drive:c:"
for %%O in (%options%) do for /f "tokens=1,* delims=:" %%A in ("%%O") do set "%%A=%%~B"
for /f "tokens=3" %%a in ('reg query "HKLM\Software\Cygwin\setup" /v "rootdir" ^|findstr /ri "REG_SZ"') do set -drive=%%~da
:loop
if not "%~1"=="" (
@Prince-Mandor
Prince-Mandor / FOR modifiers.md
Last active March 28, 2021 03:16
windows batch - FOR variables modifiers, ( AKA %~dp0 )

In addition, substitution of FOR variable references has been enhanced. You can now use the following optional syntax:

%~I         - expands %I removing any surrounding quotes (")
%~fI        - expands %I to a fully qualified path name
%~dI        - expands %I to a drive letter only
%~pI        - expands %I to a path only
%~nI        - expands %I to a file name only
%~xI        - expands %I to a file extension only
%~sI        - expanded path contains short names only

%~aI - expands %I to file attributes of file

@Prince-Mandor
Prince-Mandor / 0_reuse_code.js
Created November 8, 2016 12:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console