본문 바로가기

개발이야기

[Linux] alias 별명 만들기 프로그래밍을 하다보면 리눅스에서 같은 명령을 자주 쓰는 경우가 있다. 그 예로 루비 파일을 실행시킬 경우 ex). bundle exec shotgun runner.rb 이때 앞에 bundle exec shotgun 부분을 하나의 명령어로 만들어 줄 수 가 있다. $ vi ~/.bash_profile 그럼 .bash_profile이 열리고 적당한 부분에 'a'를 눌러 한줄을 추가해주면 된다alias 별명='줄이고 싶은 명령어'=> alias bes='bundle exec shotgun' ** 이 때 주의 할 점은 별명으로 지어줄 이름이 linux에서 사용하고 있는지 확인해야 한다. esc 버튼 :wq 으로 저장 하고 나온 후에 source ~/.bash_profile 을 해준다. 그럼이랬던 명령어가 이렇게.. 더보기
[C++] cppcheck (win) http://www.swbank.kr/html/tools/toolsFile/Cppcheck_04_howInstall.pdf tool 설치 후 아래 설정 1. Visual Studio2013 visual studio -> 도구(메뉴) -> 외부 도구 -> 추가 제목 : cppcheck명령 : C:\Program Files (x86)\Cppcheck\cppcheckgui.exe인수 : -j 8 --enable=warning,style,performance,portability,information --std=c++11 --inline-suppr --quiet --template=vs $(ItemPath)초기 디렉터리 : $(ItemDir) 실행은도구 -> cppcheck 2. QT 5.1.1 qt -> To.. 더보기
[Ruby] assert 함수 만들기 _ 주어진 조건 확인 def assert(actual, expected)if(actual == expected)puts "."elseputs "failed. expected = #{expected} but actual = #{actual}"end end assert(1, 2)assert(2, 3)assert(2, 2) 더보기
[Linux] 리눅스 터미널에서 symbolic link 만들기 터미널에서 작업을 하다가 어플리케이션을 켜야할 때가 있다. 이 때 아이콘을 찾아 클릭하지 말고 명령어로 열 수 가 있다. 그냥 바로가기 아이콘을 만들 듯이 실행 명령어를 만드는 것이다. 1. 일단 실행 파일이 있는 어플리케이션의 위치를 알아야한다.mac을 사용할 때 sublime을 예로 들어보자위치는 /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl 2. 터미널에 명령어를 쓰자 sudo ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/bin/subl subl 과 /usr 사이가 뛰어져 있음에 주의 하자 즉ln => link-s => 심볼릭 링크앞.. 더보기
[iOS] xcode-select --install error x-code 에서 Downloads 안에 Command Line Tool가 없을 경우 터미널에서 xcode-select --install 명령어로 해결해 주면 된다. 설치가 잘 되었을 경우 설치가 잘 안되었을 경우 can't install the software because it is not currently available from the software update server라고 뜨며 error가 날 경우가 있다. https://discussions.apple.com/message/23548005#23548005 You can download them as follows: Open up XcodeIn the application menu item "Xcode" select Open Develop.. 더보기
[Sinatra] Ruby, db 연결 1. 폴더를 만든다 (ex>. sinatraTest) 2. 폴더를 Sublime 으로 드래그 하면 왼쪽에 네비창이 생긴다. 3. Gemfile 을 만든다 (확장자 없이) source “http://www.rubygems.org" gem ’sinatra’ 4. 터미널에서 폴더로 들어가서 sudo gem install bundler (번들러를 설치한다) sudo bundle install 또는 bundle install (Gemfile 에 있는 sinatra를 설치한다) 5. runner.rb (루비 파일을 만든다) require ‘sinatra’ get ‘/‘ do return “Hello World!!” end 6. 터미널로 가서 해당 폴더 위치에서 ruby runner.rb (파일을 실행시킨다. 끌때는.. 더보기
[Ruby] 콜라츠 추측 콜라츠 추측 이란 http://ko.wikipedia.org/wiki/%EC%BD%9C%EB%9D%BC%EC%B8%A0_%EC%B6%94%EC%B8%A1 1. 루비를 설치2. 터미널에서 저장된 파일위치에서 디버깅ruby untitled.rb (파일명 : untitled.rb)확장자는 rb require 'benchmark' # def main# n=0 # if n1# if n%2==0# n/2# else# n*3+1# end# end# end # main() # n이 짝수: n / 2# n이 홀수: 3 * n + 1# n이 1이면 반환 # def cycle(n)# be = [] # be << n # if n % 2 == 0# be << n / 2# end# .. 더보기