This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HTTP | |
server { | |
listen 80; | |
server_name example.com www.example.com; | |
# certbot --webroot 인증을 받기위한 설정 | |
#location ^~ /.well-known/acme-challenge/ { | |
# default_type "text/plain"; | |
# root /var/www/letsencrypt; | |
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('LOG_FILE_NAME', 'deploy.log'); | |
// bitbucket payload | |
// https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push | |
$input = json_decode(file_get_contents('php://input'), true); | |
$username = $input['actor']['username']; | |
$dpname = $input['actor']['display_name']; | |
$pushData = array_pop($input['push']['changes']); | |
$branch = $pushData['new'] ? $pushData['new']['name'] : ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function httpRequest(params, postData) { | |
return new Promise(function(resolve, reject) { | |
var req = http.request(params, function(res) { | |
// reject on bad status | |
if (res.statusCode < 200 || res.statusCode >= 300) { | |
return reject(new Error('statusCode=' + res.statusCode)); | |
} | |
// cumulate data | |
var body = []; | |
res.on('data', function(chunk) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkSequnceNumbers(target, counterLength= 6){ | |
// under es6 | |
// let sequentialCounter = Array.apply(null, Array(counterLength)).map(Number.prototype.valueOf,0); | |
let sequentialCounter = new Array(counterLength).fill(0); | |
let count = 0; | |
for (let i = 0, len = target.length; i < len; i++) { | |
let subCount = 0; | |
for (let j = 1; j < len; j++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* [splitBetweenStr 텍스트 사이의 문자열을 배열로 반환] | |
* @param [string] $str [전체 문자열] | |
* @param [string] $startWord [찾을 시작 문자열] | |
* @param [string] $endWord [찾을 종료 문자열] | |
* @return [array] [텍스트 사이의 문자열 배열] | |
* | |
* ex) splitBetweenStr('<br>hi</br><b>test</b><br>graceful_light</br>', '<br>', '</br>') | |
* => ['hi', 'graceful_light'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* [postData 외부파일을 POST 방식으로 읽기] | |
* @param [string] $str [url] | |
* @param [array] $data [parameters] | |
* @param [int] $sleepMs [연결지연ms] | |
* @return [string] [내용] | |
*/ | |
function postData($str, $data, $sleepMs=0){ | |
$url = parse_url($str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* [getData 외부파일을 GET 방식으로 읽기] | |
* @param [string] $str [url] | |
* @param [array] $data [parameters] | |
* @return [string] [내용] | |
*/ | |
function getData($str, $data){ | |
$url = parse_url($str); | |
switch(strtoupper($url['scheme'])){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [downloadImage] | |
* @param {[string]} img [base64encoded image data] | |
* @param {[string]} fileName [new file name] | |
* @return [image file] | |
*/ | |
function downloadImage(img, fileName) { | |
var imgData = atob(img.src.split(',')[1]), | |
len = imgData.length, | |
buf = new ArrayBuffer(len), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
include_once "xmlrpc.inc"; | |
$title = $_POST['title']; | |
$content = $_POST['content']; | |
$result = newPost($title, $content); | |
echo json_encode($result); | |
// 블로그 API 함수 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// ctrl+d 로 줄삭제 | |
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} }, | |
// 기존 ctrl+d의 기능을 옮김 | |
{ "keys": ["ctrl+shift+k"], "command": "find_under_expand" }, | |
{ "keys": ["ctrl+k", "ctrl+shift+k"], "command": "find_under_expand_skip" }, | |
// 들여쓰기 활성화 | |
{ "keys": ["f12"], "command": "reindent" , "args": { "single_line": false } }, | |
// 파일 새로고침 | |
{ "keys": ["f5"], "command": "revert" }, |