git 사용자 이름/패스워드 Repository별 저장
git 사용시 repository별 사용자명과 패스워드를 설정하고자 할때
터미널에서 해당 repository 디렉토리에서 git config user.name "사용자명"을 입력하고,
$ git config user.name "amos"
패스워드를 다음과 같이 입력한다. git config user.password "패스워드"
git config user.password "amosxxxx"
이후에는 pull 혹은 push시 username과 password를 입력하라는 프롬프트가 안나온다.
설정되어 있는 username과 password를 보고자 할때는 .git 폴더에서 config파일을 확인하면 된다.
$ nano .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
[remote "origin"]
url = https://xxx.xxx.xx/xx/yy.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[user]
name = amos
password = amosxxx
Linux에서 파일명 일괄 변경
현재 디렉토리 하위에 있는 file명이 from으로 시작되는 모든 파일(fromxxx.xx)을 to로 시작하는 파일로 한번에 변경
$ find ./ -name "from*" | sed -e 'p' -e "s/from/to/g" | xargs -n 2 mv
rename 명령어로 변경하기
형식 : rename 's/파일명/변경할파일명/' 대상파일필터
예)
$ rename 's/from/to/' ./*
Visual Studio Code에서 arduino 사용하기
Visual Studio Code에서 arduino를 위한 확장 설치
설치순서
1.확장탭을 누르고 2.검색창에 "arduino"를 입력하면 arduino관련된 확장모듈이 검색된다. 첫번째로 검색된 Microsoft에서 나온 Arduino 확장의 3. install버튼을 클릭한다.
전제조건
Arduino IDE 필요. (다운로드 에서 arduino IDE를 다운받아 설치)
Visual Studio Code 설정
VS Code에서 < Ctrl > + < , > 두키를 동시에 누르면 Search settings 메뉴가 표출된다 여기에서 Extensions > Arduino configuration 을 선택하고
아래와 같이 Edit in settings.json를 편집한다.
{
"arduino.path": "C:/Program Files (x86)/Arduino",
"arduino.commandPath": "arduino_debug.exe",
"arduino.logLevel": "info",
"arduino.allowPDEFiletype": false,
"arduino.enableUSBDetection": true,
"arduino.disableTestingOpen": false,
"arduino.skipHeaderProvider": false,
"arduino.additionalUrls": [
"https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json",
"http://arduino.esp8266.com/stable/package_esp8266com_index.json"
],
"arduino.defaultBaudRate": 115200
}
"arduino.path" 는 위에서 arduino IDE를 설치한 디렉토리를 기재하여야 한다.
Commands
- Arduino: Board Manager: Manage packages for boards. You can add 3rd party Arduino board by configuring
Additional Board Manager URLs
in the board manager. - Arduino: Change Baud Rate: Change the baud rate of the selected serial port.
- Arduino: Change Board Type: Change board type or platform.
- Arduino: Close Serial Monitor: Stop the serial monitor and release the serial port.
- Arduino: Examples: Show list of examples.
- Arduino: Initialize: Scaffold a VS Code project with an Arduino sketch.
- Arduino: Library Manager: Explore and manage libraries.
- Arduino: Open Serial Monitor: Open the serial monitor in the integrated output window.
- Arduino: Select Serial Port: Change the current serial port.
- Arduino: Send Text to Serial Port: Send a line of text via the current serial port.
- Arduino: Upload: Build sketch and upload to Arduino board.
- Arduino: Upload Using Programmer: Upload using an external programmer.
- Arduino: Verify: Build sketch.
Reference
관련문서
Image buffer를 Bitmap file format으로 저장하기(RGB)
Image처리를 하다보면 memory buffer에 있는 image raw데이터를 BMP포멧으로 저장할 필요가 있다.
RGB Buffer(24bit)를 widows bitmap format으로 저장하는 함수
// _fname : 저장할 파일 명( xxx.bmp )
// _buf : RGB 순서로 구성된 Image buff
// _w, _h : image width, height
void saveBMPfile(char *_fname, uchar* _buf, int _w, int _h)
{
int filesize = 54 + _w * _h * 3;
unsigned char bmpfileheader[14] = {'B','M', 0,0,0,0, 0,0, 0,0, 54,0,0,0};
unsigned char bmpinfoheader[40] = {40,0,0,0, 0,0,0,0, 0,0,0,0, 1,0, 8,0};
unsigned char bmppad[3] = {0,0,0};
bmpfileheader[ 2] = (unsigned char)(filesize );
bmpfileheader[ 3] = (unsigned char)(filesize>> 8);
bmpfileheader[ 4] = (unsigned char)(filesize>>16);
bmpfileheader[ 5] = (unsigned char)(filesize>>24);
bmpinfoheader[ 4] = (unsigned char)( _w );
bmpinfoheader[ 5] = (unsigned char)( _w>> 8);
bmpinfoheader[ 6] = (unsigned char)( _w>>16);
bmpinfoheader[ 7] = (unsigned char)( _w>>24);
bmpinfoheader[ 8] = (unsigned char)( _h );
bmpinfoheader[ 9] = (unsigned char)( _h>> 8);
bmpinfoheader[10] = (unsigned char)( _h>>16);
bmpinfoheader[11] = (unsigned char)( _h>>24);
FILE* fp;
fp =fopen(_fname, "wb");
if(fp!=NULL) {
fwrite(bmpfileheader, 1, 14, fp);
fwrite(bmpinfoheader, 1, 40, fp);
fwrite(_buf, _w*_h, 3, fp);
fclose(fp);
}
}
* Gray Bufferer 저장하기 : 링크