본문 바로가기

Programming136

vscode에서 현재 Typescript 파일 디버깅... 먼저 node_modules에 ts-node와 typscript를 추가해 준다. $ npm install --save-dev ts-node typescript .vscode/launch.json 파일에 아래와 같이 추가.. { "version": "0.2.0", "configurations": [ { "name": "Debug Current ts file", "type": "node", "request": "launch", "program": "${workspaceRoot}/node_modules/ts-node/dist/bin.js", "args": ["${relativeFile}"], "cwd": "${workspaceRoot}", "protocol": "inspector", "env": { "stag.. 2019. 3. 12.
Node.js에서 euc-kr 인코딩 하기... node에서 어쩌다 보니.. euc-kr을 인코딩 디코딩 할 일이 생겨서 해 보고 고생한 김에.. 메모를 남긴다. 우선 iconv-lite 패키지를 설치해야 한다. $ npm install iconv-lite 아래는 euc-kr인 문서를 읽어서 utf-8로 바꾸고 euc-kr로 바꾸는 예제이다. let iconv = require('iconv-lite'); let fs = require('fs'); // 처음 로딩시 enc-kr 파일 let content = fs.readFileSync('content-kr.txt'); console.log(content.toString()); let utf8Str = iconv.decode(content, 'euc-kr'); console.log(utf8Str); //.. 2019. 3. 7.
Serverless를 사용해서 S3에 파일 바로 업로드 하기 Serverless file upload to S3 동작 구조 먼저 lambda 서버에 s3의 올릴 url을 요청 한다. 업로드 할 url을 받는다. 받은 s3 url에다가 파일을 보내 준다. 위와 같이 업로드를 진행 해서 자바스크립트 코드에 aws의 인증키를 노출하지 않고 S3에 바로 업로드를 진행 할 수 있다. Serverless 설치 $ npm i serverless -g # AWS 계정 설정하기 $ serverless config credentials --provider aws --key --secret Serverless 기본 프로젝트 만들기 $ serverless create --template aws-nodejs -p serverless-file-upload Serverless: Genera.. 2018. 10. 10.
PHP7.0에서 mssql 사용하기 php7.0 부터는 mssql_connect 함수가 바로 지원되지 않습니다. 그래서 다른 방법으로 mssql을 사용 해야 합니다. 그 중 한가지 방법인 sqlsrv를 사용해서 mssql을 사용하는 방법을 정리 해 봤습니다. Ubuntu 16.04 sudo su curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list exit sudo apt-get update sudo ACCEPT_EULA=Y apt-get install -y msodbcs.. 2017. 4. 20.
jQuery global Ajax event handler jQuery global Ajax event handler jquery를 사용하면서 post를 자주 사용하는데.. 유저가 로그인이 풀렸는지 확인하기 위해서 이것저것 보다.. ajax 이벤트가 글로벌로 올라 오는게 있길래 끄적여 봅니다. 아래와 같이 사용하면 됩니다. $(document).ajaxSuccess( function(event, xhr, settings){ var response; try { response = $.parseJSON(xhr.responseText); } catch(e) { response = null; } if (response) { console.log(response); }else{ console.log(xhr.responseText); } } ); 출처 : http://ap.. 2016. 10. 21.
윈도우에서 adb로 캡쳐 받기 안드로이드를 개발하다가.. 간혹 폰 캡쳐 받기를 위한 bat파일 입니다. 캡쳐 받기 위해서 불편하게 키 누르기를 안 해도 됩니다. 좀 불편한 점은 느리다는거~ @echo off for /f "tokens=2 delims==" %%G in ('wmic os get localdatetime /value') do set t=%%G set dt=%t:~0,4%-%t:~4,2%-%t:~6,2%_%t:~8,2%-%t:~10,2%-%t:~12,2% adb shell screencap -p /sdcard/screen.png adb pull /sdcard/screen.png adb shell rm /sdcard/screen.png move /y screen.png screen-%dt%.png ​ 2016. 5. 4.
안드로이드 apk 디컴파일 하기(android apk decompile) 안드로이드 프로젝트를 디컴파일 해 볼려고 인터넷을 찾다 보니.. 프로젝트 url이나 내용들이 좀 변경이 되어서.. 정리 차원에서 끄적여 봅니다. 준비물 당연한 이야기 이겠지만, 컴퓨터에 JDK가 설치 되어 있어야 합니다. 1. Dex2Jar apk이미지를 jar파일로 변환해 줍니다. URL : http://sourceforge.net/projects/dex2jar Download : http://sourceforge.net/projects/dex2jar/files 2. jd-gui jar 파일의 내용(소스코드)보여 주는 툴 URL : https://github.com/pxb1988/dex2jar Download : https://github.com/java-decompiler/jd-gui/releases.. 2015. 12. 28.
git에서 빈 디렉토리 저장하기.. git을 사용하다 보면.. 디렉토리가 비어 있으면 커밋을 해도 올라가질 않습니다.이럴때는 빈 디렉토리에 .gitkeep이렇게 빈 파일을 하나 만들어 두면... 디렉토리가 올라 갑니다.흠.. 비어 있지 않으니.. 당연히 올라 가겠죠 -_-;; 그리고, 자동으로 빈 디렉토리를 찾아서 .gitkeep 파일을 넣고 싶으면 아래와 같이 실행해 주세요. find . -type d -empty -exec touch {}/.gitkeep \; 2015. 9. 9.
Ubuntu 14.04에서 php-fpm 환경에 oracle 설정하기. 1. Oracle client instant 설치 http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html위 주소로 가서 Basic, SQL*Plus, SDK를 다운로드 받습니다. rpm파일으로 되어 있는 패키지를 설치 하기 위해서 alien을 설치 합니다.sudo apt-get install alien 그리고, 아래와 같이 설치를 합니다. sudo alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpmsudo alien -i oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpmsudo alien -i oracle-instantcli.. 2015. 7. 1.
mp3 오디오 인코딩 batch mp3파일을 일괄 인코딩해야 할 일이 생겨서 윈도우 cmd에서 쓸 batch 파일을 만들어 봤습니다. 먼저 cmd로 동작 할 파일을 아래 주소에 가서 받습니다. http://ffmpeg.zeranoe.com/builds/ 전 64bit라서.. 위와 같이 표시된 항목을 받았습니다. 다운로드 받은 파일의 압축을 풀고, bin 폴더에 있는 파일을 path가 걸린 폴더로 복사합니다.또는 아래 .bat 파일이 있는 폴더에 같이 넣어 주셔도 됩니다. 인코딩 할 상위 폴더에 .bat파일로 아래 내용을 넣고.. 실행 하시면.. 하위 폴더의 mp3와 wav 파일을 모두 preset에 지정된 옵션대로 인코딩해서 바꿔 줍니다.@echo off set formats=*.mp3 *.wav set presets=-vn -ar 4.. 2015. 5. 14.