본문 바로가기
728x90

전체 글549

pypy3 설치하는 방법 Pypy3 설치하는 방법 1. Pypy를 깔고나서 pypy3를 깔았기 때문에 pypy3부터 깔아도 잘되는지 모른다. 그래서 pypy 까는 법부터 시작한다 2. Pypy --version으로 깔려있는지 확인 3. http://egloos.zum.com/mcchae/v/11233143 4. sudo apt-get install pypy pypy-dev(sudo yum install pypy pypy-dev) curl -O https://bootstrap.pypa.io/get-pip.py sudo pypy get-pip.py pypy -m pip list 링크에 있는 글 5. pypy 설치완료 6. pypy3 설치방법 7. https://m.blog.naver.com/PostView.nhn?blogId=sto.. 2023. 1. 8.
vim color 편집하기 root 계정에서 sudo yum install vim 색 syntax on // syntax highlight를 켬 set hlsearch // 검색된 문자열을 표시 (색 변경) set encoding=utf8 // 인코딩을 utf8로 설정 ​ highlight Comment term=bold cterm=bold ctermfg=6 2023. 1. 8.
파이썬(python) 크롤링(crawling) 간단 예제(코로나 확진자수 확인) from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("http://ncov.mohw.go.kr/bdBoardList_Real.do?brdId=1&brdGubun=11&ncvContSeq=&contSeq=&board_id=&gubun=") bsObject = BeautifulSoup(html, "html.parser") #print(bsObject) table = bsObject.find('table', {'class':'num'}) trs = table.find_all('tr') for idx, tr in enumerate(trs): if idx >= 0: tds = tr.find_all('td') ths = tr.. 2023. 1. 8.
c언어 함수포인터(fp) function pointer 간단 예제 생소한 문법으로 적혀있는 코드를 보고 무엇인지 따라 추적하다가 void (*함수포인터)()라는 것을 알았다. 간단한 테스팅 소스코드를 작성해보았고 밑에 예시는 '실전'이다. #include int add(int a, int b) { return a+b; } int mul(int a, int b) { return a*b; } int main() { int (*fp)(int, int); fp = add; printf("%d\n", fp(10,20)); // 30 출력 fp = mul; printf("%d\n", fp(10,20)); // 120 출력 } a.out https://dojang.io/mod/page/view.php?id=601 #define MAX_TR 100 typedef int (*TrFun.. 2023. 1. 8.
TR전문 자르는 방식 예제(많이 쓰는 형태여서 예시코드 작성) #include "chun.h" typedef struct { char tcphead[1]; }Head; typedef struct { Head tcphead; char a[1]; char b[1]; char count[1]; }Form, *iForm; typedef struct { char name[5]; char nick[3]; }subForm, *isubForm; void TR(char *InBuf, char *OuBuf); int main() { char *InBuf = "9132abcdefgh123456789"; char *OuBuf; TR(InBuf, OuBuf); printf("OUTPUT = %s\n", OuBuf); return 0; } void TR(char *InBuf, char *O.. 2023. 1. 8.
c와 mariadb 연결하는 방법 및 예제 3 - insert+update 한번에 Mariadb INSERT INTO csv_isstatement (codename, AsOfDate, Period, FiscalYearEnd, CurrencyId, ReportType, IsCalculated, csv_isstatement.20346) VALUES ('0C000006SP', '2000-12-31', '12M', '12', 'USD', 'A', '0', '2397284.000000') ON DUPLICATE KEY UPDATE csv_isstatement.20346 = 2397284.000000; key가 codename이고 중복된 데이터가 있다면 update를 해주는 쿼리이다. 2023. 1. 8.
c언어 리눅스(linux) 디렉토리 열기(opendir) & stat 간단 예제 #include #include #include #include #include int main() { struct dirent *item; struct stat statbuf; DIR *dp; dp = opendir("/home/tqtlhj/han/"); // 경로 설정 if (dp != NULL) { while(1) { item = readdir(dp); // item에 디렉토리를 하나씩 넣어준다. lstat(item->d_name, &statbuf); // 디렉토리인지 아닌지 체크하기 위한 stat if (item == NULL) break; if(S_ISDIR(statbuf.st_mode)) // 디렉토리 일때만 출력 printf("DIR : %s\n", item->d_name); } closed.. 2023. 1. 8.
리눅스(linux) chmod 권한설정 이라면 d는 디렉토리 앞에 rwx는 'user' 그 다음은 'group', 'others' ​ chmod 777 a.out -> r:4 w:2 x:1 이기때문에 모든 권한을 주는 것이다. 4+2+1 = 7 ​ chmod o-rwx test.txt others의 권한 rwx 박탈 ​ chmod +x *.sh -> 유저에게 실행권한 부여 ​ g를 붙이면 그룹에~ 2023. 1. 8.
c언어 리눅스(linux) 데몬프로세스(daemon) 간단 예제 #include #include #include #include #include #include #include #include // 자식프로세스 fork할 용도 #include #include int main(int argc, char *argv[]) { int pid; /* fork 생성 */ pid = fork(); printf("pid = [%d] \n", pid); /* fork 에러 발생 시 로그 남긴 후 종료 */ if(pid 0){ printf("child .. 2023. 1. 8.
c언어 리눅스(linux) UDS 간단 예제 http://www.dreamy.pe.kr/zbxe/CodeClip/119393 UDS (Unix Domain Socket) 개념 2012.02.28 13:41 조회 수 29471 댓글 0 ? 단축키 Prev이전 문서 Next다음 문서 가 + - Up Down Print ? 단축키 Prev이전 문서 Next다음 문서 가 + - Up Down Print 프로세스 끼리의 통신 UDS 내부 프로세스들 끼리의 www.dreamy.pe.kr 2023. 1. 8.
728x90