WSL 상에서 동작하는 Ubuntu 앱을 사용하면서 가장 불편한 점이 터미널이다. 윈도우에서 기본으로 제공하는 터미널을 사용해야 하기 때문에 폰트도 다르고 사용 편의성도 친숙하지 않는 것같다.


WSL 상에 동작하는 Ubuntu로 일반적으로 사용하는 터미널 프로그램(SecureCRT 나 putty 등)을 사용하여 ssh로 접속하는 방법을 찾아 보니 생각하던 그 방법대로 가능하다는 것을 알게 되었다.


1. install ssh

   % sudo apt install openssh-server


2. edit the sshd_config

   % sudo vi /etc/ssh/sshd_config

   change PasswordAuthentication to yes

   add AllowerUsers [ username ]


3. generate ssh key

   % sudo ssh-keygen -A


4. restart ssh service

   % sudo service ssh --full-restart


5. add Windows Firewall

   add inbound rules related to sshd


6. 참고자료

https://www.illuminiastudios.com/dev-diaries/ssh-on-windows-subsystem-for-linux/

https://gist.github.com/dentechy/de2be62b55cfd234681921d5a8b6be11

https://www.reddit.com/r/bashonubuntuonwindows/comments/5gh4c8/ssh_to_bash_on_wsl/


'컴맹의 컴퓨터 이야기 > 개발' 카테고리의 다른 글

[유틸] fisa vim config  (1) 2019.03.05
[팁] tortoiseSVN의 blame 기능  (0) 2014.08.25
[유틸] PowerMockup  (0) 2014.02.10
[팁] cygwin에서 mongo db 사용하기  (0) 2013.08.02
[팁] cygwin에서 libpcap 사용  (0) 2013.07.08

[유틸] fisa vim config

2019. 3. 5. 14:38 | Posted by 꿈꾸는코난

a vim configuration for the modern pythonista (plus some other goodies)


This is vim configuration, built according to personal preferences, without any justification to think it's the best possible vim configuration. It's mainly oriented to python software development, but many of its features are useful for other languages and editing tasks.



< Install >


0) You will need a vim compiled with python support. Check it with vim --version | grep +python


Also, your .vim folder should be empty. If you have one, rename it or move to a different location (to keep a backup, just in case you want to go back).


1) Install the required dependencies:

sudo apt-get install curl vim exuberant-ctags git ack-grep

sudo pip install pep8 flake8 pyflakes isort yapf


2) Download the .vimrc file and place it in your linux home folder.

( wget -O ~/.vimrc  https://raw.github.com/fisadev/fisa-vim-config/master/.vimrc )


3) Open vim and it will continue the installation by itself. Wait for it to finish... and done! You now have your new shiny powerful vim :)



< Most important features include: >


Plugins managed using Vim-plug! You can easily install or remove plugins, and they are installed into .vim/plugged/. More info here


Smart autocompletion as you type, sometimes using python instrospection (completion of module names, instance methods and attributes) and sometimes text-based (used words) (from version 4.0, it's even more intelligent!). And with neocomplcache, it even can autocomplete with typos, thanks to the fuzzy completion settings.


Fuzzy file, code and command finder (like Textmante or Sublime Text 2):


,e = open file (like the original :e) but with recursive and fuzzy file name matching. Example: if you type "mopy" it will find a file named "models.py" placed on a subdirectory. And allows you to open the selected file on a new tab with Ctrl-t!

,g = fuzzy symbol finder (classes, methods, variables, functions, ...) on the current file. Example: if you type "usr" it will find the User class definition on the current file. ,G does the same but on all opened files.

,c = fuzzy command finder (internal vim commands, or custom commands). Example: if you type "diff" it will find :GitDiff, :diffthis, and many other similar commands.

,f = fuzzy text finder on all the opened files. Example: if you type "ctm=6" it will find the line containing "current_time = 16".

,m = fuzzy finder of most recently used files.

,we, ,wg, ,wc, ,wf and ,wm = same as ,e, ,g, ,c, ,f and ,wm but initiate the search with the word under the cursor (also the upper case version of ,G, ,wG). Is useful to think about the ,wg as a "fuzzy go to definition" (if the definition is in the same file, or ,wG if the definition is on any of the opened files).

,pe = same as ,e but initiates the search with the path under the cursor.

Ropevim for really neat python goodies!:


Go to definition with ,d, or open the definition on a new tab with ,D.

Find occurrences with ,o.

Classes/module browser that lists classes, functions, methods, and such of the current file, and navigates to them when ENTER is pressed. Toggle it with F4.


Pending tasks browser pressing F2. This reads the current file searching for comments that start with "TODO", "FIXME", and such, and shows them on a list that allows navigation similar to the class browser.


Error checking of code using Syntastic (it will detect unused variables or imports, syntax errors, and such), for several languages, highlighting the errors and warnings in the code. You can open an errors list with \e. In python, the error checking includes pep8 validation, and pylint.


Grep code recursively and navigate the results:


,r uses the ack command (a kind of grep optimized for code search), lists the found matches, and allows you to open them with ENTER.

,wr does the same, but searching the word under the cursor.

Some settings for better tabs and spaces handling.


Better file browser, toggle it with F3, or open it with your current file selected using ,t.


Results count while searching text.


Search and read python documentation with the :Pydoc command. Example: :Pydoc collections (also works over the current word with vim's default help keybinding: Shift-K).


Comment and uncomment code with \ci.


Easy tab navigation:


tt = new tab and leaves the cursor waiting to specify the file path to open (leave blank to open an empty tab).

tn or Ctrl-Shift-Right = next tab.

tp or Ctrl-Shift-Left = previous tab.

tm = move current tab to a specific position (or to the end if no position number is specified).

tl = show a list of current tabs with their inner windows on a side pane. You can navigate them!

ts = duplicate current tab.

The mappings starting with the t letter work only on command mode, but the mappings with Ctrl-Shift work on both, command and insert mode.


Easy window navigation using Alt-arrows keys.


Some vim goodies enabled by default:


incremental search (moves to the first result while you are typing).

highlighted search results.

line numbers.

keep cursor 3 lines away from screen border while scrolling.

shell-like autocompletion of commands and paths (autocomplete the common part and show matching options).

syntax highlighting on by default.

Python interpreter inside vim, or any other console. They are opened as a buffer using the command :ConqueTerm. Examples: :ConqueTerm python, :ConqueTerm bash.


Save current file as sudo using :w!!.


Navigate html/xml tags the same way that you navigate (), {} and []: using %.


Beautiful status line allways visible, with colors, breadcrumbs and useful information about file type, encoding and position. When working with python files, it also displays the current python function or class where the cursor is.


Automatically removes trailing spaces when saving python files.


Smart autoclosing of (, [, and {


Beautiful color schemes for on vim with 256 colors (fisa colorscheme) and gvim (wombat colorscheme).


Use of 256 colors when possible.


2 spaces indentation for html and javascript (can disable it removing two lines from the .vimrc).


Thousands of code snippets for many languages with SnipMate. Example, in python you can write cl and press tab (while in inser mode), and it will insert the boilerplate code of a common python class (then use tab to navigate the snippet fields).


Zen coding for html: generate lots of html code writing simple and short expressions. Example:


write #books>ul>li.book*5>a


press Ctrl-y ,


it will generate:


<div id="books">

    <ul>

        <li class="book">

            <a href=""></a>

        </li>

        <li class="book">

            <a href=""></a>

        </li>

        <li class="book">

            <a href=""></a>

        </li>

        <li class="book">

            <a href=""></a>

        </li>

        <li class="book">

            <a href=""></a>

        </li>

    </ul>

</div>


Git and other vcs integration, with commands such as: :GitStatus, :GitDiff, :GitBlame, :GitLog, :GitCommit, or simply :Git with your own command. Key mappings and syntax highlighting for git displays. Displays icons on the side of each line based on the result of a diff of the current file (example: if you added a line and still didn't commit the file, that line will have a green + on its side). And finally, when on a changed file you can jump through changes using \sn and \sp.


Better python indentation.


Really neat surround actions using the surround.vim plugin. Learn how to use it here.


Indentation defined text objects for the editing language, named i. For example, you can change an entire indented code block with cii, or the indented block and its header line with cai (also yank, delete, ...).


Indentation based movements, move to the header of your current python block with [-, to the end of the block with ]-, and more (short reference here).


Python class and method/function text objects for the editing language, named C and M. For example, you can change an entire function content with ciM, or delete a class including its header with daC.


Run the current python file and display the output on a split with \r.


Insert and remove ipdb breakpoints with \b.


Copy history navigation using the YankRing plugin, which allows you to cicle the vim clipboard with Ctrl-p and Ctrl-n, and many other features (described here).


Insert ipdb breakpoints with \b.


Automatically sort python imports using :Isort.


Persistent undos modify file, exit vim, reopen file, and you can undo changes done on the previous session.


Better paths for temporary swap files, backups, and persistent undos (all of them stored under ~/.vim/dirs).


Drag visual blocks (blocks selected on Ctrl-v and Shift-v visual modes) with Shift-Alt-arrows, or even duplicate them with D.


Simple window chooser: press - and you will see big green letters for each window. Just press the letter of the window you want to activate.


Paint css color values with the actual color.


Format Python code using yapf (:YapfFullFormat formats the whole file, and has other commands as well, explained here. Works only if you have a vim compiled with python 2, not python 3).


Custom configs by folder add a .vim.custom file in the project's root folder with whatever configs you want to customize for that project. For example, if you have a project tree like this example and you want to exclude folder_x from FuzzyFinder, put let g:ctrlp_custom_ignore["dir"] = g:ctrlp_custom_ignore["dir"] . '|\v[\/]folder_x$' in the .vim.custom file.


project

├── folder_1

├── folder_2

├── folder_x

└── .vim.custom

[팁] tortoiseSVN의 blame 기능

2014. 8. 25. 14:35 | Posted by 꿈꾸는코난

TortoiseSVN Blame  기능

 

히스토리 볼 파일을 선택하고, TortoisSVN -> Blame을 선택하면 된다.

 

손쉽게 특정 라인은 누가 checkin했는지와 히스토리를 라인 단위로 볼 수 있다.

 

 

http://tortoisesvn.net/docs/nightly/TortoiseSVN_sk/tsvn-dug-blame.html

 

 

[유틸] PowerMockup

2014. 2. 10. 14:51 | Posted by 꿈꾸는코난

인터넷을 뒤지다 우연히 발견한 PowerMockup

 

www.powermockup.com

 

위 싸이트에서 Free Trial 버전을 받아 설치하면 PowerPoint에서 바로 사용할 수 있다.

 

 

 

대략 보면 알겠지만 powerpoint에서 쉽게 mockup을 작성하기 위한 툴이라고 생각하면 된다. 사실 mockup을 만들기 위해 Powerpoint 기본 도구로 손보기에는 시간도 많이 소요되고 만족할 만한 디자인이 나오지 않는다.

하지만 powermockup을 사용하게 되면 기본적인 많은 stencil이 있기 때문에 쉽게 가져와서 사용할 수 있다는 잇점이 있다.

다만 trial version을 각 카테고리별로 3개씩만 사용할 수 있다는 단점이 있다.

 

홈페이에 있는 개략적인 소개를 보면,

 

먼저 powermockup을 이용한 mockup.

 

 

기본적인 기능 설명

 

 

 

전체 기능을 다 사용해 보면 좋을 것 같다.

 

cygwin에서 mongo db 설치하고 사용하기

 

테스트를 위해 cygwin에서 mongo db 설치하고 테스트 해 보기로 했다.

근데 cygwin에서 어플을  수행하기 위해서는 별로 cygwin 환경에 맞추어진 바이너리를 설치해야 한다고 생각했다.

그래서 cygwin 환경에 많는 설치 패키지를 찾기 위해 검색을 했는데 그 결과는 예상밖이었다.

별로 설치 패키지 없이 윈도우용 mongo db 패키지를 설치하고, 그걸 cygwin 환경에 맞게 복사만 해주면 되는 거였다.

 

차례대로 보면.

 

1. mongo db 설치하기

   -. www.mongodb.org/downloads 에서 설치패키지 다운로드

     

     

 

2. 패키지 압축 풀기

    -. mongodb-win32-x86_64-2008plus-v2.0-latest.zip 압축 풀기

 

3. 바이너리 파일 복사

    -. 압축 푼 디렉토리 안에 있는 bin 폴더 안의 모든 파일을 다음 디텍토리로 복사

       c:\cygwin\usr\local\bin

 

4. 테스트

    -. mongod 실행

 

 

    -. mongo 실행 

 

특별한 추가작업없이 정상적으로 잘 동작하는 것을 확인할 수 있었다.

 

 

[팁] cygwin에서 libpcap 사용

2013. 7. 8. 18:02 | Posted by 꿈꾸는코난

cygwin을 설치하고 여러가지 테스트해 보던 중 tcpreplay를 설치해 보기로 헀다.

그런데 tcpreplay 소스를 받아서 빌드해 볼려고 하니 libpcap이 없어서 빌드가 되지 않는다.

libpcap을 설치하기 위해 구글링을 해보니 다음과 같은 방법이 있었다.

 

1. Setup Winpcap

 

1. Download and unzip the pack. We will use for this example WpdPack_4_0_1.zip.
2. Copy libraries like this:
  • WpdPack\Lib\libpacket.a to cygwin\lib\
  • WpdPack\Lib\libwpcap.a to cygwin\lib\

3. Create a folder cygwin\usr\include\pcap\
4. Copy all headers from WpdPack\Include to cygwin\usr\include\winpcap\
5. Be sure you have installed Winpcap libraries and that they are in your path by 

    typing:

  • which Packet.dll
  • which wpcap.dll

 

2. Building example using cygwin

 

< basic_dump > CFLAGS="-g -Wall -mno-cygwin -I /usr/include/pcap"
LIBS="-lwpcap"
PROG="basic_dump"
gcc $CFLAGS -c $PROG.c
gcc $CFLAGS -o $PROG.exe $PROG.o $LIBS
./$PROG.exe

 

위 과정을 거쳐 libpcap은 정상 설치 가능하다.

 

그러나 tcpreplay를 설치하기 위해서는 가야할 길이 험난하다.

없는 라이브러리도 많고... 일단 보류해야 겠다.

 

 

[팁] cygwin에서 proftpd 사용하기

2013. 6. 28. 13:26 | Posted by 꿈꾸는코난

회사에서 테스트를 위해 cygwin을 깔아서 이것 저것 테스트를 진행해 봤다.

유틸리티나 컴파일 등은 아무런 문제없이 잘 되는데 유독 서버 프로그램들(FTP, HTTP) 등은 잘 동작하지 않는 것을 확인했다.

분명  설치되어 있는 걸 보면 동작은 할텐데...

싸이트를 뒤지다 보니 별도의 서버를 돌려야지만 이러한 서버 프로그램이 동작한다는 것을 알게 되었다.

 

1. 설정파일 변경(/etc/proftpd.conf)

 

# Set the user and group under which the server will run.
User                            SYSTEM
Group                           Administrators

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

 

2. 서버를 서비스로 기동

 

cygrunsrv --install proftpd \
          --path /usr/sbin/proftpd.exe \
          --args "--nodaemon" \
          --type manual \
          --disp "CYGWIN proftpd" \
          --desc "ProFTPd FTP daemon"

 

3. 서버 시작

 

cygsrunsrv --start proftpd

 

이렇게 해놓고 FTP 접속해 보면 잘 접속되는 것을 알 수 있다.

 

개요

 

 

 

연평균 성장률 전망

 

 

 

 

 

갤럭시탭 10.1 ICS 업그레이드

2013. 1. 22. 13:57 | Posted by 꿈꾸는코난

지난번 지금 사용하는 갤탭 10.1을 아이스크림 샌드위치로 업그레이드하려다 실패했었다. 음.. 뭐랄까 업그레이드를 위해 설치해야 하는 Kies 프로그램이 문제가 있는건지 계속 내 갤탭에 연결하지 못하는거다. 반나절 정도 시도하다 그만뒀었다.

근데 요 며칠새 갤탭 홈 화면이 나타나지 않아 도무지 사용할 방법이 없었다. 그냥 초기화할까 생각하다 다시 다 설치하기 힘들어서 ICS 업데이트를 다시 시도해보기로 했다.

먼저 Kies를 시작하니 Kies 부터 업데이트 하란다. 업데이트를 하면서 인터넷 검색을 해보니 이전에  내가 업그레이드 못한 것과 동일한 문제를 가진 사람들이 많았나 보다. 해결책으로 제시하는게, 갤탭에 접속 시도 툴을 하나 깔면 잘 된다고 한다. 난 깔수도 없는데...

하여튼 해당 문제가 새로운 Kies에서 해결됐으리라 믿고 다시 시도해보니 여전히 안된다. 이리저리 몇번 케이블 뽑고 다시 시작하고 몇번을 하니 겨우 갤탭 연결되고 업그레이드를 시작한다. 이후에는 한번에 패스~

아직 뭐가 많이 달라졌는지 살펴보기는 힘들고, 차근차근 사용해봐야겠다.

루팅을 하고 싶은데 ICS 루팅에 대해서는 자료가 별로 없네~

 

List of WLAN channels

2012. 11. 29. 09:15 | Posted by 꿈꾸는코난

List of WLAN channels


This list of WLAN channels is the set of legally allowed Wireless LAN channels using IEEE 802.11.

The 802.11 workgroup currently documents use in three distinct frequency ranges, 2.4 GHz, 3.6 GHz and 4.9/5.0 GHz bands. Each range is divided into a multitude of channels. Countries apply their own regulations to both the allowable channels, allowed users and maximum power levels within these frequency ranges. In some countries, such as the United States, licensed Amateur Radio operators may use some of the channels at much higher power for long distance wireless access.