Skip to content

Instantly share code, notes, and snippets.

View CreatiCoding's full-sized avatar
❤️
Maybe busy by something

정석호 CreatiCoding

❤️
Maybe busy by something
View GitHub Profile
@CreatiCoding
CreatiCoding / .bashrc
Created November 7, 2018 07:52
ubuntu bash color mode with git branch
# 생략
# ~
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
@CreatiCoding
CreatiCoding / feconf-css-animation-rocket-intro-with-scene-js.markdown
Created November 3, 2018 05:48
FEConf CSS Animation Rocket Intro with scene.js
@CreatiCoding
CreatiCoding / js_sort.js
Last active October 27, 2018 19:41
js sort solution 완주하지 못한 선수
// https://programmers.co.kr/learn/courses/30/lessons/42576
function solution(p, c) {
var size = c.length;
// 이렇게 하면 오류 발생
// p.sort((a,b)=>(a < b));
// 이렇게 하면 속도 느림
// p.sort((a,b)=>(a.localeCompare(b)));
// 속도 제일 빠르고 정확함
p.sort((a,b)=>(a < b ? -1 : (a > b ? 1 : 0)));
c.sort((a,b)=>(a < b ? -1 : (a > b ? 1 : 0)));
#1 make ssh key
cd ~
ssh-keygen
#2 regist ~/.ssh/id_rsa.pub to github account
cat ~/.ssh/id_rsa.pub
#3 add remote url if already exist repository
git remote set-url origin git@github.com:username/your-repository.git
@CreatiCoding
CreatiCoding / service.sh
Created October 6, 2018 03:25
start nodemon with nohup without output file
# in service.sh
nohup ./start.sh </dev/null >/dev/null 2>&1 &
@CreatiCoding
CreatiCoding / CyclicRotation.js
Created September 13, 2018 08:55
[codility] CyclicRotation
// you can write to stdout for debugging purposes, e.g.
// console.log('this is a debug message');
function solution(A, K) {
let arr = [];
// write your code in JavaScript (Node.js 8.9.4)
if(A.length === K || K === 0 || A.length === 0){
return A;
}
for(let i = 0 ; i < K ; i ++ ){
@CreatiCoding
CreatiCoding / multithread_increase_server.cpp
Last active August 10, 2018 08:52
tcp socket one increase server with multi thread c++11
#include <cstdio>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <iostream>
#include <thread>
@CreatiCoding
CreatiCoding / one_process_increase_client.cpp
Last active August 10, 2018 06:55
c++ socket tcp one process one thread increase one server and client
#include <cstdio>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <iostream>
@CreatiCoding
CreatiCoding / printDivToPdf.js
Last active January 27, 2021 09:18
[javascript] Div to html in chrome
function printElement(ele, w = 800, h = 400){
var divContents = document.querySelector(ele).innerHTML;
var printWindow = window.open('', '', `height=${h},width=${w}`);
printWindow.document.write('<html><head><title>NoName</title>');
printWindow.document.write('</head><body >');
printWindow.document.write(divContents);
printWindow.document.write('</body></html>');
printWindow.document.close();
printWindow.print();
}
@CreatiCoding
CreatiCoding / install-cra-express.sh
Created July 29, 2018 10:25
[bash] npm install global create-react-app and express-generator
sudo npm install -g yarn
sudo yarn global add create-react-app
sudo yarn global add express-generator
sudo yarn global add nodemon
sudo yarn global add concurrently
# 에러 발생시 global node_modules 초기화
# for create-react-app with redux and router
# yarn add redux react-redux
# yarn add react-router-dom