프로그램 사용/squid2019. 4. 4. 07:49

관련 문서 정리

흐음.. hier_direct를 못하도록 막으면 통신이 안되고 어떻게 할 방법이 없나..

캐시 구조에서 상위로 돌리도록 하고 상위에서 어떻게 처리가 가능할줄 알았는데..

 

[링크 : http://www.squid-cache.org/Doc/config/nonhierarchical_direct/]

[링크 : https://wiki.squid-cache.org/Features/CacheHierarchy]

[링크 : https://wiki.squid-cache.org/SquidFaq/SquidLogs#Hierarchy_Codes]

[링크 : http://www.squid-cache.org/Doc/config/url_rewrite_program/]

[링크 : https://github.com/rchunping/squid-urlrewrite]

'프로그램 사용 > squid' 카테고리의 다른 글

squid 캐시에 합류하기  (0) 2019.04.04
squid storeid... 에러  (0) 2019.04.03
squid storeid  (0) 2019.04.03
squid storeurl_rewrite  (0) 2019.04.02
lynx proxy  (0) 2019.03.27
Posted by 구차니

기존에는 standard로 썼는데, standard는 문단 정렬 기능이 먹지 않아서 full로 설정해주어야 적용이 된다.

The following distributions (see comparison table) are available:

  • basic - the Basic preset
  • standard - the Standard preset
  • standard-all - the Standard preset together with all other plugins created by CKSource*
  • full - the Full preset
  • full-all - the Full preset together with all other plugins created by CKSource*

[링크 : https://cdn.ckeditor.com/]

 

옵션을 만들어주는 사이트

기본은 아래와 같이 생성해주는데

CKEDITOR.editorConfig = function( config ) {
config.toolbar = [
{ name: 'document', items: [ 'Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] },
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
{ name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
'/',
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] },
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
{ name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] },
{ name: 'about', items: [ 'About' ] }
];
};

 

코드에서 쓰려면 config. 이후를 붙이고 수정하면된다.

<script src="https://cdn.ckeditor.com/4.11.3/full/ckeditor.js"></script>

<script>

CKEDITOR.replace('ckeditor4', {

uploadUrl: '/uploader',

toolbar : [ 
{ name: 'document', items: [ 'Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] }, 
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] }, 
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] }, 
{ name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] }, 
'/', 
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] }, 
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] }, 
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] }, 
{ name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] }, 
'/', 
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] }, 
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] }, 
{ name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] }, 
{ name: 'about', items: [ 'About' ] } 
]

});

</script>

[링크 : https://ckeditor.com/latest/samples/toolbarconfigurator/index.html#basic]

'프로그램 사용 > ckeditor(웹에디터)' 카테고리의 다른 글

ckeditor 모드별 모양  (0) 2019.03.08
ckeditor file upload with node.js  (0) 2019.03.07
ckeditor / fckeditor?  (0) 2014.07.16
ckeditor 사용하기  (0) 2013.02.22
fckeditor plugin for squirrelMail  (0) 2011.06.14
Posted by 구차니
프로그램 사용/squid2019. 4. 3. 14:50

storeid를 해보려고 ruby 스크립트까지 해보는데 안되서 급 멘붕..

에러를 천천히 보니 일단은 new_format.rb가 실행이 안되는 듯한데

# systemctl status squid 
● squid.service - Squid caching proxy 
   Loaded: loaded (/usr/lib/systemd/system/squid.service; enabled; vendor preset: disabled) 
   Active: failed (Result: exit-code) since 수 2019-04-03 14:40:47 KST; 5ms ago 
  Process: 20020 ExecStop=/usr/sbin/squid -k shutdown -f $SQUID_CONF (code=exited, status=1/FAILURE) 
  Process: 19848 ExecStart=/usr/sbin/squid $SQUID_OPTS -f $SQUID_CONF (code=exited, status=0/SUCCESS) 
  Process: 19842 ExecStartPre=/usr/libexec/squid/cache_swap.sh (code=exited, status=0/SUCCESS) 
 Main PID: 19851 (code=exited, status=1/FAILURE) 

 4월 03 14:40:47 localhost squid[19851]: Squid Parent: (squid-1) process 19990 started 
 4월 03 14:40:47 localhost (squid-1)[19990]: The store_id helpers are crashing too rapidly, need help! 
 4월 03 14:40:47 localhost squid[19851]: Squid Parent: (squid-1) process 19990 exited with status 1 
 4월 03 14:40:47 localhost squid[19851]: Squid Parent: (squid-1) process 19990 will not be restarted due to repeated, frequent failures 
 4월 03 14:40:47 localhost squid[19851]: Exiting due to repeated, frequent failures 
 4월 03 14:40:47 localhost systemd[1]: squid.service: main process exited, code=exited, status=1/FAILURE 
 4월 03 14:40:47 localhost squid[20020]: squid: ERROR: Could not send signal 15 to process 19990: (3) No such process 
 4월 03 14:40:47 localhost systemd[1]: squid.service: control process exited, code=exited status=1 
 4월 03 14:40:47 localhost systemd[1]: Unit squid.service entered failed state. 
 4월 03 14:40:47 localhost systemd[1]: squid.service failed. 

 

퍼미션은 진작에 +x로 줬는데 안되고

If you get this error:

FATAL: The store_id helpers are crashing too rapidly, need help!

check for permssions

[링크 : https://github.com/rudiservo/pfsense_storeid]

 

그냥 해당 스크립트를 실행해보니 에러 발생.. libxml...?

# ruby new_format.rb
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- libxml (LoadError)
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from new_format.rb:8:in `'

그래서 검색해서 해당 모듈을 까는데 안깔린다!!!

# gem install -r libxml-ruby 
Fetching: libxml-ruby-3.1.0.gem (100%) 
Building native extensions.  This could take a while... 
ERROR:  Error installing libxml-ruby: 
        ERROR: Failed to build gem native extension. 

    /usr/bin/ruby extconf.rb 
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h 


Gem files will remain installed in /usr/local/share/gems/gems/libxml-ruby-3.1.0 for inspection. 
Results logged to /usr/local/share/gems/gems/libxml-ruby-3.1.0/ext/libxml/gem_make.out 

[링크 : https://github.com/xml4r/libxml-ruby]

 

ruby 모듈 하나 설치하려고 먼가 잔뜩 깔게 하다니..

yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel ruby-devel libxml2 libxml2-devel libxslt libxslt-devel git

[링크 : https://gist.github.com/lovellfelix/8135631]

'프로그램 사용 > squid' 카테고리의 다른 글

squid 캐시에 합류하기  (0) 2019.04.04
squid hierarchy와 cache  (0) 2019.04.04
squid storeid  (0) 2019.04.03
squid storeurl_rewrite  (0) 2019.04.02
lynx proxy  (0) 2019.03.27
Posted by 구차니
프로그램 사용/nginx2019. 4. 3. 14:15

ckeditor에 파일을 올리는데 localhost에서는 잘만 올라가는 놈인데

회사 서버에만 하면 안되서 리눅스 버전이 문제인가 고민을 했지만..

/uploader:1 Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

일단은 node.js 쪽 설정은 기본으로도 충분히 잘 올라가는 상황이라 아래 내용은 별 의미없어 보이고

혹시나 리눅스용은 먼가 다른가 해서 했지만 안올라가는건 여전한 상황 -_-

[링크 : https://stackoverflow.com/questions/19917401/error-request-entity-too-large]

[링크 : http://meonggae.blogspot.com/2016/11/http-response-code-413.html]

 

 

검색을 하다보니 갑자기 반짝하는 키워드.. 아...

nginx에서 reverse proxy로 쓰고 있었는데 nginx에서도 body 크기가 제한되는데 이걸 풀어줘야 정상작동 한다.

http {
    client_max_body_size 5M;

}

[링크 : https://github.com/expressjs/body-parser/issues/235]

'프로그램 사용 > nginx' 카테고리의 다른 글

(angluar/react) router와 nginx  (0) 2019.05.31
nginx 502 bad gateway와 audit  (0) 2019.03.20
nginx rever proxy with virtual host(+ subdomain)  (0) 2019.03.07
nginx load balance  (0) 2019.03.05
nginx reverse proxy  (2) 2018.10.30
Posted by 구차니
프로그램 사용/squid2019. 4. 3. 13:32

store_urlrewrite_progam 을 써보려고 했더니 2.7 only로 되어 있어서..

Feature: Store URL Rewriting?
Goal: Separate out the URL used for storage lookups from the URL used for forwarding. This allows for multiple destination URLs to reference the same backend content and cut back on duplicated content, both for forward proxies (think "google maps") and CDN type reverse proxies.

Status: deprecated. see StoreID

[링크 : https://wiki.squid-cache.org/Features/StoreUrlRewrite]

 

이걸 봐야 할 듯..

[링크 : https://wiki.squid-cache.org/Features/StoreID]

'프로그램 사용 > squid' 카테고리의 다른 글

squid hierarchy와 cache  (0) 2019.04.04
squid storeid... 에러  (0) 2019.04.03
squid storeurl_rewrite  (0) 2019.04.02
lynx proxy  (0) 2019.03.27
url_rewriter squid  (0) 2019.03.15
Posted by 구차니

자출할때 비싼 자전거 두기 부담스러운데

그래서 자전거를 맡길 공간을 빌려주겠다!라는 컨셉인가 아닌가 헷갈리는 회사

(사이트 가서 보니 창고 임대도 가능한듯)

 

아무튼 로드는 월 19.8만 MTB는 22만

근데 이 정도면... 헬스 + 월간 주차료 보다 비싼거 아냐?

걍 차 끌고 다니는게 나을지도 모르겠는데?

 

[링크 : http://bike-park.co.kr]

 

 

+

근 2년만에 엔도몬도 다시 깔고 아침에 일찍 출근해져서 자전거 탐

어제 점심엔 위로 한정거정 갔는데 오늘은 아래로 한정거장

약하지만 역풍으로 시작해서 그런지 갈떄보다 올때가 빠르네

그나저나 겨우 4.5km 인데 허벅지 아프당 ㅠㅠ

 

+

오가는길에 보니 한진택배 임대 붙여 놨더라..

한진택배 배송창고에서 이런거 맡아주면 싸게 할 거 같은데 아쉽네?

'개소리 왈왈 > 자전거' 카테고리의 다른 글

2019 자전거 대행진 신청!  (2) 2019.04.24
2019 서울 자전거 대행진!  (2) 2019.04.23
하루 늦은 지름 신고(?)  (0) 2019.03.17
바 테잎 감음  (0) 2019.03.15
간만에 자전거 포 갔더니..  (3) 2019.03.10
Posted by 구차니
Programming/openMPI2019. 4. 2. 22:27

MPI + thread 어쩌구 나오길래 보는 중

openMPI는 Message Passing Interface니까.. 받는 쪽에 데몬이 있어야 할텐데

어떤식으로 주고 받는지 모르겠네..

 

[링크 : http://wgropp.cs.illinois.edu/courses/cs598-s16/lectures/lecture36.pdf]

[링크 : http://ympahk.blogspot.com/2014/05/openmpi.html]

[링크 : http://ap2.khu.ac.kr/download/mpi_lec.pdf]

[링크 : https://www.open-mpi.org/faq/?category=running]

 

+

2019.04.03

서비스 돌리는거 보면 의외로 별거 없는데.. 어떻게 설정하는거지?

[링크 : https://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-4.x/CentOS_SL_RHEL]

'Programming > openMPI' 카테고리의 다른 글

ubuntu mpich cluster  (0) 2017.02.05
opempi 패키지  (0) 2017.02.04
openmpi with heterogenerous  (0) 2017.02.03
openmpi with openmp  (0) 2017.02.03
OpenMP 그리고 OpenMPI  (2) 2011.09.19
Posted by 구차니

흐음. 정규표현식은 매번 써도 모르겠다...

아무튼 내용을 없는걸로 치환하면 될 듯

 

[링크 : https://soooprmx.com/archives/7718]

[링크 : https://stackoverflow.com/.../regular-expression-to-remove-one-parameter-from-query-string]

[링크 : https://stackoverflow.com/.../how-do-you-match-multiple-regex-patterns-for-a-single-line-of-text-in-java]

 

 

'Programming > regexp(정규표현식)' 카테고리의 다른 글

정규 표현식.. 반복  (0) 2019.09.17
정규표현식 n개 이상  (0) 2019.08.30
regexp non-capturing group  (0) 2019.08.22
정규표현식 - regular expression  (0) 2009.01.18
Posted by 구차니
프로그램 사용/squid2019. 4. 2. 19:05

squid의 cache는 url과 rewrite된 url을 기준으로 매칭을 한다는데

다르게 생각하면.. GET 방식으로 주소가 줄줄이 붙어 버리면 당연히 url이 매치가 안되니 hit 할 수 없고

rewrite를 통해서 특정 인자를 빼버리고 놔두면 캐싱이 되려나?

(근데 생각해보면.. youtube에서 많은 부분이 HIRE_NONE이라.. 될런지)

 

[링크 : https://stackoverflow.com/questions/2721919/how-to-ignore-query-parameters-in-web-cache]

[링크 : http://www.squid-cache.org/Doc/config/storeurl_rewrite_program/]

[링크 : http://alter.org.ua/soft/win/squid_url_rewrite/]

'프로그램 사용 > squid' 카테고리의 다른 글

squid storeid... 에러  (0) 2019.04.03
squid storeid  (0) 2019.04.03
lynx proxy  (0) 2019.03.27
url_rewriter squid  (0) 2019.03.15
squid hierarchy  (0) 2019.03.14
Posted by 구차니
Programming/node.js2019. 4. 2. 16:32

NodeMITMProxyCA 라는녀석이 생성되서 찾아보니 아래의 경로에 생성을 한다.

흐음.. 서비스 용으로 만들려면 이 이름을 어떻게 바꿔치워야 겠네? ㅠㅠ

./.http-mitm-proxy/certs/ca.pem
./.http-mitm-proxy/keys/ca.private.key
./.http-mitm-proxy/keys/ca.public.key

[링크 : https://github.com/greim/hoxy]

[링크 : https://stackoverflow.com/questions/10085082/node-http-proxy-ssl-transparent]

[링크 : https://github.com/TotallyInformation/node-proxy-https-example/blob/master/proxy.js]

[링크 : https://www.npmjs.com/package/http-mitm-proxy]

 

 

아래는 span 에 들어있는 내용을 죄다 Pwned로 바꿔치기 하는 기본 예제를 변형한 녀석

 

var Proxy = require('http-mitm-proxy');
var proxy = Proxy();
var path = require('path');

proxy.use(Proxy.wildcard);

proxy.onError(function(ctx, err) {
  console.error('proxy error:', err);
});

proxy.onRequest(function(ctx, callback) {
//  if (ctx.clientToProxyRequest.headers.host == 'www.google.com'
//    && ctx.clientToProxyRequest.url.indexOf('/search') == 0
//    )
 {
    ctx.use(Proxy.gunzip);

    ctx.onResponseData(function(ctx, chunk, callback) {
//      chunk = new Buffer(chunk.toString().replace(/<h3.*?<\/h3>/g, '<h3>Pwned!</h3>'));
        console.log(chunk.toString());
      chunk = new Buffer(chunk.toString().replace(/<span.*?<\/span>/g, '<span>Pwned!</span>'));
      return callback(null, chunk);
    });
  }
  return callback();
});

proxy.onRequestData(function(ctx, chunk, callback) {
  console.log('REQUEST DATA:', chunk.toString());
  return callback(null, chunk);
});

/*
proxy.onCertificateRequired = function(hostname, callback) {
  return callback(null, {
    keyFile: path.resolve('key.pem'),
    certFile: path.resolve('cert.pem'),
    hosts: ["*"]
  });
};
*/
proxy.listen({port: 8080});

 

사용자가 생성한 인증서를 이용하여 서비스하기

[링크 : http://blog.saltfactory.net/implements-nodejs-based-https-server/]

var Proxy = require('http-mitm-proxy');
var proxy = Proxy();
var path = require('path');

proxy.use(Proxy.wildcard);

proxy.onError(function(ctx, err) {
  console.error('proxy error:', err);
});

proxy.onRequest(function(ctx, callback) {
 {
    ctx.use(Proxy.gunzip);

    ctx.onResponseData(function(ctx, chunk, callback) {
      chunk = new Buffer(chunk.toString().replace(/<span.*?<\/span>/g, '<span>Pwned!</span>'));
      return callback(null, chunk);
    });
  }
  return callback();
});

proxy.onCertificateRequired = function(hostname, callback) {
  return callback(null, {
    keyFile: path.resolve('key.pem'),
    certFile: path.resolve('cert.pem'),
    hosts: ["*.mydomain.com"]
  });
};
proxy.listen({port: 8080});

[링크 : https://github.com/horaci/node-mitm-proxy]

[링크 : https://www.npmjs.com/package/mitm-proxy]

Posted by 구차니